mips: add JR.HB & JALR.HB instructions. also update Ocaml/Python/Java bindings
diff --git a/arch/Mips/MipsMapping.c b/arch/Mips/MipsMapping.c
index c0744a2..016626c 100644
--- a/arch/Mips/MipsMapping.c
+++ b/arch/Mips/MipsMapping.c
@@ -4843,7 +4843,7 @@
#endif
},
{
- Mips_JALR_HB, MIPS_INS_JALR,
+ Mips_JALR_HB, MIPS_INS_JALR_HB,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { MIPS_GRP_STDENC, MIPS_GRP_MIPS32, 0 }, 0, 1
#endif
@@ -4903,13 +4903,13 @@
#endif
},
{
- Mips_JR_HB, MIPS_INS_JR,
+ Mips_JR_HB, MIPS_INS_JR_HB,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { MIPS_GRP_STDENC, MIPS_GRP_MIPS32, MIPS_GRP_NOTMIPS32R6, MIPS_GRP_NOTMIPS64R6, 0 }, 1, 1
#endif
},
{
- Mips_JR_HB_R6, MIPS_INS_JR,
+ Mips_JR_HB_R6, MIPS_INS_JR_HB,
#ifndef CAPSTONE_DIET
{ 0 }, { 0 }, { MIPS_GRP_STDENC, MIPS_GRP_MIPS32R6, 0 }, 1, 1
#endif
@@ -9867,32 +9867,17 @@
// alias instructions
{ MIPS_INS_NOP, "nop" },
{ MIPS_INS_NEGU, "negu" },
-};
-// special alias insn
-static name_map alias_insn_names[] = {
- { MIPS_INS_NOP, "nop" },
- { MIPS_INS_BEQZ, "beqz" },
- { MIPS_INS_BAL, "bal" },
- { MIPS_INS_BC1T, "bc1t" },
- { MIPS_INS_BC1F, "bc1f" },
- { MIPS_INS_NEGU, "negu" },
+ { MIPS_INS_JALR_HB, "jalr.hb" },
+ { MIPS_INS_JR_HB, "jr.hb" },
};
const char *Mips_insn_name(csh handle, unsigned int id)
{
#ifndef CAPSTONE_DIET
- unsigned int i;
-
if (id >= MIPS_INS_MAXIMUM)
return NULL;
- // handle special alias first
- for (i = 0; i < ARR_SIZE(alias_insn_names); i++) {
- if (alias_insn_names[i].id == id)
- return alias_insn_names[i].name;
- }
-
return insn_name_maps[id].name;
#else
return NULL;
@@ -9963,11 +9948,6 @@
// handle special alias first
unsigned int i;
- for (i = 0; i < ARR_SIZE(alias_insn_names); i++) {
- if (!strcmp(alias_insn_names[i].name, name))
- return alias_insn_names[i].id;
- }
-
// NOTE: skip first NULL name in insn_name_maps
i = name2id(&insn_name_maps[1], ARR_SIZE(insn_name_maps) - 1, name);
diff --git a/bindings/java/capstone/Mips_const.java b/bindings/java/capstone/Mips_const.java
index b70776d..c5907b7 100644
--- a/bindings/java/capstone/Mips_const.java
+++ b/bindings/java/capstone/Mips_const.java
@@ -792,7 +792,11 @@
// some alias instructions
public static final int MIPS_INS_NOP = 582;
public static final int MIPS_INS_NEGU = 583;
- public static final int MIPS_INS_MAXIMUM = 584;
+
+ // special instructions
+ public static final int MIPS_INS_JALR_HB = 584;
+ public static final int MIPS_INS_JR_HB = 585;
+ public static final int MIPS_INS_MAXIMUM = 586;
// Group of MIPS instructions
diff --git a/bindings/ocaml/mips_const.ml b/bindings/ocaml/mips_const.ml
index b1c0c32..b6d27bb 100644
--- a/bindings/ocaml/mips_const.ml
+++ b/bindings/ocaml/mips_const.ml
@@ -789,7 +789,11 @@
(* some alias instructions *)
let _MIPS_INS_NOP = 582;;
let _MIPS_INS_NEGU = 583;;
-let _MIPS_INS_MAXIMUM = 584;;
+
+(* special instructions *)
+let _MIPS_INS_JALR_HB = 584;;
+let _MIPS_INS_JR_HB = 585;;
+let _MIPS_INS_MAXIMUM = 586;;
(* Group of MIPS instructions *)
diff --git a/bindings/python/capstone/mips_const.py b/bindings/python/capstone/mips_const.py
index d74b48b..68a8d6b 100644
--- a/bindings/python/capstone/mips_const.py
+++ b/bindings/python/capstone/mips_const.py
@@ -789,7 +789,11 @@
# some alias instructions
MIPS_INS_NOP = 582
MIPS_INS_NEGU = 583
-MIPS_INS_MAXIMUM = 584
+
+# special instructions
+MIPS_INS_JALR_HB = 584
+MIPS_INS_JR_HB = 585
+MIPS_INS_MAXIMUM = 586
# Group of MIPS instructions
diff --git a/include/mips.h b/include/mips.h
index e1d481d..1554b56 100644
--- a/include/mips.h
+++ b/include/mips.h
@@ -844,6 +844,10 @@
MIPS_INS_NOP,
MIPS_INS_NEGU,
+ //> special instructions
+ MIPS_INS_JALR_HB, // jump and link with Hazard Barrier
+ MIPS_INS_JR_HB, // jump register with Hazard Barrier
+
MIPS_INS_MAXIMUM,
} mips_insn;
diff --git a/tests/test_detail.c b/tests/test_detail.c
index bd5241a..1b51c75 100644
--- a/tests/test_detail.c
+++ b/tests/test_detail.c
@@ -39,7 +39,7 @@
#define ARM_CODE2 "\x10\xf1\x10\xe7\x11\xf2\x31\xe7\xdc\xa1\x2e\xf3\xe8\x4e\x62\xf3"
#define THUMB_CODE "\x70\x47\xeb\x46\x83\xb0\xc9\x68"
#define THUMB_CODE2 "\x4f\xf0\x00\x01\xbd\xe8\x00\x88\xd1\xe8\x00\xf0"
-#define MIPS_CODE "\x0C\x10\x00\x97\x00\x00\x00\x00\x24\x02\x00\x0c\x8f\xa2\x00\x00\x34\x21\x34\x56"
+#define MIPS_CODE "\x0C\x10\x00\x97\x00\x00\x00\x00\x24\x02\x00\x0c\x8f\xa2\x00\x00\x34\x21\x34\x56\x00\x80\x04\x08"
//#define MIPS_CODE "\x21\x38\x00\x01"
//#define MIPS_CODE "\x21\x30\xe6\x70"
//#define MIPS_CODE "\x1c\x00\x40\x14"