summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2016-05-30 22:40:24 -0400
committerRusty Wagner <rusty@vector35.com>2016-05-30 22:40:24 -0400
commit4dc7c3041e7c95e373b55dbb27b1861e82976fc0 (patch)
tree84c56f913999eef22384a65c8343d07f29df17d4
parenteb2ba156a6dc7654e143d46f79384066a2e5e4a3 (diff)
Add IL instruction to promote bool to int, used for MIPS jump tables
-rw-r--r--binaryninjaapi.h1
-rw-r--r--binaryninjacore.h1
-rw-r--r--lowlevelil.cpp6
-rw-r--r--python/__init__.py1
4 files changed, 9 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 7ece4c4d..72240975 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -1545,6 +1545,7 @@ namespace BinaryNinja
ExprId CompareSignedGreaterThan(size_t size, ExprId a, ExprId b);
ExprId CompareUnsignedGreaterThan(size_t size, ExprId a, ExprId b);
ExprId TestBit(size_t size, ExprId a, ExprId b);
+ ExprId BoolToInt(size_t size, ExprId a);
ExprId SystemCall();
ExprId Breakpoint();
ExprId Trap(uint32_t num);
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 41388a98..cbbfcfa8 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -245,6 +245,7 @@ extern "C"
LLIL_CMP_SGT,
LLIL_CMP_UGT,
LLIL_TEST_BIT,
+ LLIL_BOOL_TO_INT,
LLIL_SYSCALL,
LLIL_BP,
LLIL_TRAP,
diff --git a/lowlevelil.cpp b/lowlevelil.cpp
index d86bb523..550accc2 100644
--- a/lowlevelil.cpp
+++ b/lowlevelil.cpp
@@ -428,6 +428,12 @@ ExprId LowLevelILFunction::TestBit(size_t size, ExprId a, ExprId b)
}
+ExprId LowLevelILFunction::BoolToInt(size_t size, ExprId a)
+{
+ return AddExpr(LLIL_BOOL_TO_INT, size, 0, a);
+}
+
+
ExprId LowLevelILFunction::SystemCall()
{
return AddExpr(LLIL_SYSCALL, 0, 0);
diff --git a/python/__init__.py b/python/__init__.py
index 6776ef09..75d114cd 100644
--- a/python/__init__.py
+++ b/python/__init__.py
@@ -3987,6 +3987,7 @@ class LowLevelILInstruction(object):
core.LLIL_CMP_SGT: [("left", "expr"), ("right", "expr")],
core.LLIL_CMP_UGT: [("left", "expr"), ("right", "expr")],
core.LLIL_TEST_BIT: [("left", "expr"), ("right", "expr")],
+ core.LLIL_BOOL_TO_INT: [("src", "expr")],
core.LLIL_SYSCALL: [],
core.LLIL_BP: [],
core.LLIL_TRAP: [("value", "int")],