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>,
Paolo Bonzini <pbonzini@redhat.com>,
Marcin Nowakowski <marcin.nowakowski@imgtec.com>,
Huacai Chen <chenhc@lemote.com>, <linux-kernel@vger.kernel.org>,
James Hogan <james.hogan@imgtec.com>,
Andrew Morton <akpm@linux-foundation.org>,
Paul Burton <paul.burton@imgtec.com>
Subject: [PATCH v2 5/5] MIPS: microMIPS: Fix decoding of swsp16 instruction
Date: Wed, 1 Mar 2017 14:41:20 +0000 [thread overview]
Message-ID: <1488379280-2954-6-git-send-email-matt.redfearn@imgtec.com> (raw)
In-Reply-To: <1488379280-2954-1-git-send-email-matt.redfearn@imgtec.com>
When the immediate encoded in the instruction is accessed, it is sign
extended due to being a signed value being assigned to a signed integer.
The ISA specifies that this operation is an unsigned operation.
The sign extension leads us to incorrectly decode:
801e9c8e: cbf1 sw ra,68(sp)
As having an immediate of 1073741809.
Since the instruction format does not specify signed/unsigned, and this
is currently the only location to use this instuction format, change it
to an unsigned immediate.
Fixes: bb9bc4689b9c ("MIPS: Calculate microMIPS ra properly when unwinding the stack")
Suggested-by: Paul Burton <paul.burton@imgtec.com>
Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
---
Changes in v2: None
arch/mips/include/uapi/asm/inst.h | 2 +-
arch/mips/kernel/process.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/include/uapi/asm/inst.h b/arch/mips/include/uapi/asm/inst.h
index 77429d1622b3..711d9b8465b8 100644
--- a/arch/mips/include/uapi/asm/inst.h
+++ b/arch/mips/include/uapi/asm/inst.h
@@ -964,7 +964,7 @@ struct mm16_r3_format { /* Load from global pointer format */
struct mm16_r5_format { /* Load/store from stack pointer format */
__BITFIELD_FIELD(unsigned int opcode : 6,
__BITFIELD_FIELD(unsigned int rt : 5,
- __BITFIELD_FIELD(signed int simmediate : 5,
+ __BITFIELD_FIELD(unsigned int imm : 5,
__BITFIELD_FIELD(unsigned int : 16, /* Ignored */
;))))
};
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 1113f1f15bc1..0f4c0b3769ca 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -212,7 +212,7 @@ static inline int is_ra_save_ins(union mips_instruction *ip, int *poff)
if (ip->mm16_r5_format.rt != 31)
return 0;
- *poff = ip->mm16_r5_format.simmediate;
+ *poff = ip->mm16_r5_format.imm;
*poff = (*poff << 2) / sizeof(ulong);
return 1;
--
2.7.4
prev parent reply other threads:[~2017-03-01 18:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-01 14:41 [PATCH v2 0/5] MIPS: Further microMIPS stack unwinding fixes Matt Redfearn
2017-03-01 14:41 ` [PATCH v2 1/5] MIPS: Handle non word sized instructions when examining frame Matt Redfearn
2017-03-01 14:41 ` [PATCH v2 2/5] MIPS: microMIPS: Fix decoding of addiusp instruction Matt Redfearn
2017-03-01 14:41 ` [PATCH v2 3/5] MIPS: Refactor handling of stack pointer in get_frame_info Matt Redfearn
2017-03-01 14:41 ` [PATCH v2 4/5] MIPS: Stacktrace: Fix __usermode() of uninitialised regs Matt Redfearn
2017-03-01 14:41 ` Matt Redfearn [this message]
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=1488379280-2954-6-git-send-email-matt.redfearn@imgtec.com \
--to=matt.redfearn@imgtec.com \
--cc=akpm@linux-foundation.org \
--cc=chenhc@lemote.com \
--cc=james.hogan@imgtec.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=marcin.nowakowski@imgtec.com \
--cc=paul.burton@imgtec.com \
--cc=pbonzini@redhat.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®