aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorSteven J. Hill <sjhill@mips.com>2013-02-05 17:52:03 -0500
committerSteven J. Hill <Steven.Hill@imgtec.com>2013-05-01 17:32:47 -0400
commitbfd08baae4591eca753afe3c9c63c583c4d4c78a (patch)
tree28719c486310951c63939017b837b65689160840 /arch/mips
parenta6a4834cdbef23a7db16e7598c8c6e427ac82531 (diff)
MIPS: microMIPS: Add instruction utility macros.
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. [ralf@linux-mips.org: Removed unnecessary parenthesis as noted by Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>] Signed-off-by: Steven J. Hill <sjhill@mips.com> Cc: linux-mips@linux-mips.org Cc: cernekee@gmail.com Cc: kevink@paralogos.com Cc: ddaney.cavm@gmail.com Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Patchwork: https://patchwork.linux-mips.org/patch/4924/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> (cherry picked from commit 49df26472338b935fd5781bf94a77a88b148a716)
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/include/asm/mipsregs.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index 0da44d422f5b..f64e17fa3e96 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -623,6 +623,24 @@
623#ifndef __ASSEMBLY__ 623#ifndef __ASSEMBLY__
624 624
625/* 625/*
626 * Macros for handling the ISA mode bit for microMIPS.
627 */
628#define get_isa16_mode(x) ((x) & 0x1)
629#define msk_isa16_mode(x) ((x) & ~0x1)
630#define set_isa16_mode(x) do { (x) |= 0x1; } while(0)
631
632/*
633 * microMIPS instructions can be 16-bit or 32-bit in length. This
634 * returns a 1 if the instruction is 16-bit and a 0 if 32-bit.
635 */
636static inline int mm_insn_16bit(u16 insn)
637{
638 u16 opcode = (insn >> 10) & 0x7;
639
640 return (opcode >= 1 && opcode <= 3) ? 1 : 0;
641}
642
643/*
626 * Functions to access the R10000 performance counters. These are basically 644 * Functions to access the R10000 performance counters. These are basically
627 * mfc0 and mtc0 instructions from and to coprocessor register with a 5-bit 645 * mfc0 and mtc0 instructions from and to coprocessor register with a 5-bit
628 * performance counter number encoded into bits 1 ... 5 of the instruction. 646 * performance counter number encoded into bits 1 ... 5 of the instruction.