MIPS: mm: uasm: Add signed 9-bit immediate related macros
MIPS R6 redefines several instructions and reduces the immediate field to 9-bits so add related macros for the microassembler. Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
This commit is contained in:
parent
7fd08ca58a
commit
51eec48e12
|
@ -24,7 +24,8 @@ enum fields {
|
||||||
JIMM = 0x080,
|
JIMM = 0x080,
|
||||||
FUNC = 0x100,
|
FUNC = 0x100,
|
||||||
SET = 0x200,
|
SET = 0x200,
|
||||||
SCIMM = 0x400
|
SCIMM = 0x400,
|
||||||
|
SIMM9 = 0x800,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define OP_MASK 0x3f
|
#define OP_MASK 0x3f
|
||||||
|
@ -41,6 +42,8 @@ enum fields {
|
||||||
#define FUNC_SH 0
|
#define FUNC_SH 0
|
||||||
#define SET_MASK 0x7
|
#define SET_MASK 0x7
|
||||||
#define SET_SH 0
|
#define SET_SH 0
|
||||||
|
#define SIMM9_SH 7
|
||||||
|
#define SIMM9_MASK 0x1ff
|
||||||
|
|
||||||
enum opcode {
|
enum opcode {
|
||||||
insn_invalid,
|
insn_invalid,
|
||||||
|
@ -116,6 +119,14 @@ static inline u32 build_scimm(u32 arg)
|
||||||
return (arg & SCIMM_MASK) << SCIMM_SH;
|
return (arg & SCIMM_MASK) << SCIMM_SH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline u32 build_scimm9(s32 arg)
|
||||||
|
{
|
||||||
|
WARN((arg > 0xff || arg < -0x100),
|
||||||
|
KERN_WARNING "Micro-assembler field overflow\n");
|
||||||
|
|
||||||
|
return (arg & SIMM9_MASK) << SIMM9_SH;
|
||||||
|
}
|
||||||
|
|
||||||
static inline u32 build_func(u32 arg)
|
static inline u32 build_func(u32 arg)
|
||||||
{
|
{
|
||||||
WARN(arg & ~FUNC_MASK, KERN_WARNING "Micro-assembler field overflow\n");
|
WARN(arg & ~FUNC_MASK, KERN_WARNING "Micro-assembler field overflow\n");
|
||||||
|
|
Loading…
Reference in New Issue