| To: | linux-mips@linux-mips.org |
|---|---|
| Subject: | [PATCH 4/4] MIPS: microMIPS: Add instruction utility macros. |
| From: | "Steven J. Hill" <sjhill@mips.com> |
| Date: | Tue, 5 Feb 2013 16:52:03 -0600 |
| Cc: | "Steven J. Hill" <sjhill@mips.com>, ralf@linux-mips.org, cernekee@gmail.com, kevink@paralogos.com, ddaney.cavm@gmail.com |
| In-reply-to: | <1360104723-29529-1-git-send-email-sjhill@mips.com> |
| List-archive: | <http://www.linux-mips.org/archives/linux-mips/> |
| List-help: | <mailto:ecartis@linux-mips.org?Subject=help> |
| List-id: | linux-mips <linux-mips.eddie.linux-mips.org> |
| List-owner: | <mailto:ralf@linux-mips.org> |
| List-post: | <mailto:linux-mips@linux-mips.org> |
| List-software: | Ecartis version 1.0.0 |
| List-subscribe: | <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips> |
| List-unsubscribe: | <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips> |
| References: | <1360104723-29529-1-git-send-email-sjhill@mips.com> |
| Sender: | linux-mips-bounce@linux-mips.org |
From: "Steven J. Hill" <sjhill@mips.com>
Add two new macros for microMIPS. One checks if an exception was
taken in either microMIPS or classic MIPS mode. The other checks
if a microMIPS instruction is 16-bit or 32-bit in length.
Signed-off-by: Steven J. Hill <sjhill@mips.com>
---
arch/mips/include/asm/mipsregs.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index f206ef2..13e1d68 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -622,6 +622,24 @@
#ifndef __ASSEMBLY__
/*
+ * Macros for handling the ISA mode bit for microMIPS.
+ */
+#define get_isa16_mode(x) ((x) & 0x1)
+#define msk_isa16_mode(x) ((x) & ~0x1)
+#define set_isa16_mode(x) do { (x) |= 0x1; } while(0)
+
+/*
+ * microMIPS instructions can be 16-bit or 32-bit in length. This
+ * returns a 1 if the instruction is 16-bit and a 0 if 32-bit.
+ */
+static inline int mm_insn_16bit(u16 insn)
+{
+ u16 opcode = (insn >> 10) & 0x7;
+
+ return ((opcode >= 1 && opcode <= 3) ? 1 : 0);
+}
+
+/*
* Functions to access the R10000 performance counters. These are
basically
* mfc0 and mtc0 instructions from and to coprocessor register with a 5-bit
* performance counter number encoded into bits 1 ... 5 of the instruction.
--
1.7.9.5
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 3/4] MIPS: microMIPS: uasm: Add microMIPS micro assembler support., Steven J. Hill |
|---|---|
| Next by Date: | Re: [PATCH v2 07/18] KVM/MIPS32: MMU/TLB operations for the Guest., Gleb Natapov |
| Previous by Thread: | [PATCH 3/4] MIPS: microMIPS: uasm: Add microMIPS micro assembler support., Steven J. Hill |
| Next by Thread: | Re: [PATCH 4/4] MIPS: microMIPS: Add instruction utility macros., Sergei Shtylyov |
| Indexes: | [Date] [Thread] [Top] [All Lists] |