Skip to content

Commit 6b89dc9

Browse files
committed
merge with main
2 parents dbcca7c + f5273b2 commit 6b89dc9

File tree

178 files changed

+15354
-3007
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+15354
-3007
lines changed

CMakeLists.txt

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,41 @@ add_library(binaryninjaapi STATIC ${BN_API_SOURCES})
3333
target_include_directories(binaryninjaapi
3434
PUBLIC ${PROJECT_SOURCE_DIR})
3535

36-
find_package(BinaryNinjaCore REQUIRED)
37-
target_link_libraries(binaryninjaapi PUBLIC ${BinaryNinjaCore_LIBRARIES})
38-
target_link_directories(binaryninjaapi PUBLIC ${BinaryNinjaCore_LIBRARY_DIRS})
39-
target_compile_definitions(binaryninjaapi PUBLIC ${BinaryNinjaCore_DEFINITIONS})
36+
find_package(BinaryNinjaCore)
37+
if(BinaryNinjaCore_FOUND)
38+
target_link_libraries(binaryninjaapi PUBLIC ${BinaryNinjaCore_LIBRARIES})
39+
target_link_directories(binaryninjaapi PUBLIC ${BinaryNinjaCore_LIBRARY_DIRS})
40+
target_compile_definitions(binaryninjaapi PUBLIC ${BinaryNinjaCore_DEFINITIONS})
41+
else()
42+
if(APPLE)
43+
target_link_options(binaryninjaapi PUBLIC -undefined dynamic_lookup)
44+
elseif(MSVC)
45+
# Generate stubs.cpp with implementations of all the BNAPI functions
46+
execute_process(COMMAND python ${PROJECT_SOURCE_DIR}/cmake/generate_stubs.py ${PROJECT_SOURCE_DIR}/binaryninjacore.h ${PROJECT_BINARY_DIR}/stubs)
47+
48+
# Compile those stubs into a stub library we can use to fool the linker
49+
add_library(binaryninjacore SHARED ${PROJECT_BINARY_DIR}/stubs/stubs.cpp)
50+
set_target_properties(binaryninjacore
51+
PROPERTIES OUTPUT_NAME binaryninjacore
52+
SOVERSION 1
53+
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/stubs
54+
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/stubs
55+
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/stubs
56+
)
57+
target_include_directories(binaryninjacore PUBLIC ${PROJECT_SOURCE_DIR})
58+
59+
# Be sure to only link against the stubs archive file
60+
add_dependencies(binaryninjaapi binaryninjacore)
61+
if(${CMAKE_GENERATOR} MATCHES "^Visual Studio")
62+
# Visual Studio's generator adds the config to the file path
63+
target_link_libraries(binaryninjaapi PUBLIC "$<TARGET_PROPERTY:binaryninjacore,ARCHIVE_OUTPUT_DIRECTORY>/$<CONFIG>/$<TARGET_PROPERTY:binaryninjacore,OUTPUT_NAME>.lib")
64+
else()
65+
target_link_libraries(binaryninjaapi PUBLIC "$<TARGET_PROPERTY:binaryninjacore,ARCHIVE_OUTPUT_DIRECTORY>/$<TARGET_PROPERTY:binaryninjacore,OUTPUT_NAME>.lib")
66+
endif()
67+
else()
68+
target_link_options(binaryninjaapi PUBLIC "LINKER:--allow-shlib-undefined")
69+
endif()
70+
endif()
4071

4172
if(BN_REF_COUNT_DEBUG)
4273
target_compile_definitions(binaryninjaapi PUBLIC BN_REF_COUNT_DEBUG)
@@ -94,16 +125,18 @@ function(bn_install_plugin target)
94125
list(APPEND CMAKE_MODULE_PATH "${BN_API_SOURCE_DIR}/cmake")
95126

96127
# BinaryNinjaCore has the user plugins dir define that we want
97-
find_package(BinaryNinjaCore REQUIRED)
98-
if(WIN32)
99-
install(TARGETS ${target} RUNTIME
100-
DESTINATION ${BinaryNinjaCore_USER_PLUGINS_DIR})
101-
102-
install(FILES $<TARGET_PDB_FILE:${target}>
103-
DESTINATION ${BinaryNinjaCore_USER_PLUGINS_DIR} OPTIONAL)
104-
else()
105-
install(TARGETS ${target} LIBRARY
106-
DESTINATION ${BinaryNinjaCore_USER_PLUGINS_DIR})
128+
find_package(BinaryNinjaCore)
129+
if(BinaryNinjaCore_FOUND)
130+
if(WIN32)
131+
install(TARGETS ${target} RUNTIME
132+
DESTINATION ${BinaryNinjaCore_USER_PLUGINS_DIR})
133+
134+
install(FILES $<TARGET_PDB_FILE:${target}>
135+
DESTINATION ${BinaryNinjaCore_USER_PLUGINS_DIR} OPTIONAL)
136+
else()
137+
install(TARGETS ${target} LIBRARY
138+
DESTINATION ${BinaryNinjaCore_USER_PLUGINS_DIR})
139+
endif()
107140
endif()
108141
endif()
109142
endfunction()

README.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,10 @@ Online documentation is available for the following APIs:
1515
- [Rust API, Stable Branch](https://rust.binary.ninja/)
1616
- [Rust API, Dev Branch](https://rust-dev.binary.ninja/)
1717

18-
## Branches
19-
20-
This repository has two primary branches [`dev`](/Vector35/binaryninja-api/tree/dev/) and [`master`](/Vector35/binaryninja-api/tree/master/).
21-
22-
The `dev` branch has the latest updates and tracks the latest development build of Binary Ninja; pull requests should be made against this branch. The `master` branch tracks the stable build of Binary Ninja. If you have just installed Binary Ninja for the first time, you are likely on the stable release channel.
23-
2418
## Usage and Build Instructions
2519

20+
**In order to build the Binary Ninja API, you will need to use the specific revision that matches the hash from the file `api_REVISION.txt`.** This file should be located in the root install folder for Linux and Windows or the `Contents/Resources` sub-folder of the app on macOS. The easiest way to do this is by cloning this repository (or adding it as a submodule) and doing something like `git checkout $(cat api_REVISION.txt | awk -F/ '{print $NF}')`. Documentation for how to set this up with something like `cmake` can be found [here](https://docs.binary.ninja/dev/plugins.html?h=api_#cmake-setup).
21+
2622
To write Binary Ninja plugins using C++, you'll need to build the C++ API. Building the API library is done similarly to most CMake-based projects; the basic steps are outlined as follows:
2723

2824
```Bash
@@ -70,13 +66,18 @@ There are many examples available. The [Python examples folder](https://github.c
7066

7167
The issue tracker for this repository tracks not only issues with the source code contained here but also the broader Binary Ninja product.
7268

69+
## Branches
70+
71+
This repository has two primary branches [`dev`](/Vector35/binaryninja-api/tree/dev/) and [`master`](/Vector35/binaryninja-api/tree/master/).
72+
73+
The `dev` branch has the latest updates and tracks the latest development build of Binary Ninja; pull requests should be made against this branch. The `master` branch tracks the stable build of Binary Ninja. If you have just installed Binary Ninja for the first time, you are likely on the stable release channel.
74+
7375
## Contributing
7476

7577
Public contributions are welcome to this repository. Most of the API and documentation in this repository is licensed under an MIT license, however, the API interfaces with a closed-source commercial application, [Binary Ninja](https://binary.ninja). Additionally, the [Rust API](https://github.com/Vector35/binaryninja-api/tree/dev/rust) is [licensed](https://github.com/Vector35/binaryninja-api/tree/dev/rust/LICENSE) under a Apache 2.0 license.
7678

7779
If you're interested in contributing when you submit your first PR, you'll receive a notice from [CLA Assistant](https://cla-assistant.io/) that allows you to sign our [Contribution License Agreement](https://binary.ninja/cla.pdf) online.
7880

79-
8081
## Platforms
8182

8283
This repository contains all of our Platform plugins available here:
@@ -91,14 +92,15 @@ This repository contains all of our Platform plugins available here:
9192

9293
## Architectures
9394

94-
This repository contains all of our Architecture plugins available here:
95+
This repository contains all of the Architecture plugins available in Personal and Commercial editions of Binary Ninja. You can find each architecture here:
9596

97+
* [x86/x86_64](https://github.com/Vector35/binaryninja-api/tree/dev/arch/x86)
98+
* [ARM64](https://github.com/Vector35/binaryninja-api/tree/dev/arch/arm64)
9699
* [ARMv7](https://github.com/Vector35/binaryninja-api/tree/dev/arch/armv7)
97100
* [PPC](https://github.com/Vector35/binaryninja-api/tree/dev/arch/powerpc)
98-
* [MIPS32](https://github.com/Vector35/binaryninja-api/tree/dev/arch/mips)
99-
* [ARM64](https://github.com/Vector35/binaryninja-api/tree/dev/arch/arm64)
100-
* [x86/x86_64](https://github.com/Vector35/binaryninja-api/tree/dev/arch/x86)
101-
* [RISCV](https://github.com/Vector35/binaryninja-api/tree/dev/arch/riscv)
101+
* [MIPS](https://github.com/Vector35/binaryninja-api/tree/dev/arch/mips)
102+
* [RISC-V](https://github.com/Vector35/binaryninja-api/tree/dev/arch/riscv)
103+
* [MSP430](https://github.com/Vector35/binaryninja-api/tree/dev/arch/msp430)
102104

103105

104106
## BinaryViewTypes
@@ -114,6 +116,8 @@ This repository contains all of our Binary View Type plugins available here:
114116
## DebugInfo
115117

116118
* [DWARF Import](https://github.com/Vector35/binaryninja-api/tree/dev/rust/examples/dwarf/dwarf_import)
119+
* [PDB Import](https://github.com/Vector35/binaryninja-api/tree/dev/rust/examples/pdb-ng)
120+
* [IDB Import](https://github.com/Vector35/binaryninja-api/tree/dev/rust/examples/idb_import)
117121

118122

119123
## Related Repositories

api-docs/source/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ def generaterst():
229229
#
230230
# The short X.Y version.
231231
version = u'.'.join(str(binaryninja.core_version()).split('.')[0:2])
232-
release = str(binaryninja.core_version())
232+
# The longer X.Y.Z-channel version. (We intentionally strip the edition.)
233+
release = str(binaryninja.core_version().split(' ')[0])
233234

234235
language = 'en'
235236

arch/arm64/arch_arm64.cpp

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ class Arm64Architecture : public Architecture
10401040
// on it to fill the next array.
10411041
static_assert(Arm64Intrinsic::ARM64_INTRIN_AUTDA == 0,
10421042
"Invalid first Arm64Intrinsic value. Please add your intrinsic further in the enum.");
1043-
1043+
10441044
// Normal intrinsics.
10451045
for (uint32_t id = Arm64Intrinsic::ARM64_INTRIN_AUTDA; id < Arm64Intrinsic::ARM64_INTRIN_NORMAL_END; id++) {
10461046
result.push_back(id);
@@ -1856,7 +1856,7 @@ class Arm64Architecture : public Architecture
18561856
REG_TRCCIDCVR5, REG_TRCVMIDCVR5, REG_TRCCIDCVR6, REG_TRCVMIDCVR6,
18571857
REG_TRCCIDCVR7, REG_TRCVMIDCVR7, REG_TRCITCTRL, REG_TRCCLAIMSET,
18581858
REG_TRCCLAIMCLR, REG_TRCLAR, REG_TEECR32_EL1, REG_TEEHBR32_EL1, REG_DBGDTR_EL0,
1859-
REG_DBGDTRTX_EL0, REG_DBGVCR32_EL2, REG_SCTLR_EL1, REG_ACTLR_EL1,
1859+
REG_DBGDTRTX_EL0, REG_DBGVCR32_EL2, REG_MPIDR_EL1, REG_SCTLR_EL1, REG_ACTLR_EL1,
18601860
REG_CPACR_EL1, REG_RGSR_EL1, REG_GCR_EL1, REG_TRFCR_EL1, REG_TTBR0_EL1,
18611861
REG_TTBR1_EL1, REG_TCR_EL1, REG_APIAKEYLO_EL1, REG_APIAKEYHI_EL1,
18621862
REG_APIBKEYLO_EL1, REG_APIBKEYHI_EL1, REG_APDAKEYLO_EL1, REG_APDAKEYHI_EL1,
@@ -3021,11 +3021,18 @@ class Arm64ElfRelocationHandler : public RelocationHandler
30213021
auto info = reloc->GetInfo();
30223022
if (len < info.size)
30233023
return false;
3024-
uint64_t* dest64 = (uint64_t*)dest;
3025-
uint32_t* dest32 = (uint32_t*)dest;
3026-
uint16_t* dest16 = (uint16_t*)dest;
3027-
// auto swap = [&arch](uint32_t x) { return (arch->GetEndianness() == LittleEndian)? x :
3028-
// bswap32(x); };
3024+
3025+
BNEndianness endianness = view->GetDefaultEndianness();
3026+
auto write64 = [&endianness](uint64_t* dest64, uint64_t val) {
3027+
*dest64 = endianness == LittleEndian ? val : ToBE64(val);
3028+
};
3029+
auto write32 = [&endianness](uint32_t* dest32, uint32_t val) {
3030+
*dest32 = endianness == LittleEndian ? val : ToBE32(val);
3031+
};
3032+
auto write16 = [&endianness](uint16_t* dest16, uint16_t val) {
3033+
*dest16 = endianness == LittleEndian ? val : ToBE16(val);
3034+
};
3035+
30293036
uint64_t target = reloc->GetTarget();
30303037
Instruction inst;
30313038
switch (info.nativeType)
@@ -3036,12 +3043,12 @@ class Arm64ElfRelocationHandler : public RelocationHandler
30363043
case R_AARCH64_P32_COPY:
30373044
case R_AARCH64_P32_GLOB_DAT:
30383045
case R_AARCH64_P32_JUMP_SLOT:
3039-
dest32[0] = target;
3046+
write32((uint32_t*)dest, target);
30403047
break;
30413048
case R_AARCH64_COPY:
30423049
case R_AARCH64_GLOB_DAT:
30433050
case R_AARCH64_JUMP_SLOT:
3044-
dest64[0] = target;
3051+
write64((uint64_t*)dest, target);
30453052
break;
30463053
case R_AARCH64_ADR_PREL_LO21:
30473054
break;
@@ -3058,41 +3065,41 @@ class Arm64ElfRelocationHandler : public RelocationHandler
30583065
case R_AARCH64_ADD_ABS_LO12_NC:
30593066
{
30603067
ADD_SUB_IMM* decode = (ADD_SUB_IMM*)dest;
3061-
aarch64_decompose(dest32[0], &inst, reloc->GetAddress());
3068+
aarch64_decompose(*(uint32_t*)dest, &inst, reloc->GetAddress());
30623069
decode->imm = target + info.addend;
30633070
break;
30643071
}
30653072
case R_AARCH64_CALL26:
30663073
case R_AARCH64_JUMP26:
30673074
{
30683075
UNCONDITIONAL_BRANCH* decode = (UNCONDITIONAL_BRANCH*)dest;
3069-
aarch64_decompose(dest32[0], &inst, 0);
3076+
aarch64_decompose(*(uint32_t*)dest, &inst, 0);
30703077
decode->imm = (target + info.addend - reloc->GetAddress()) >> 2;
30713078
break;
30723079
}
30733080
case R_AARCH64_ABS16:
3074-
dest16[0] = (uint16_t)(target + info.addend);
3081+
write16((uint16_t*)dest, target + info.addend);
30753082
break;
30763083
case R_AARCH64_ABS32:
3077-
dest32[0] = (uint32_t)(target + info.addend);
3084+
write32((uint32_t*)dest, target + info.addend);
30783085
break;
30793086
case R_AARCH64_ABS64:
3080-
dest64[0] = target + info.addend;
3087+
write64((uint64_t*)dest, target + info.addend);
30813088
break;
30823089
case R_AARCH64_PREL16:
3083-
dest16[0] = (uint16_t)(info.addend + target - reloc->GetAddress());
3090+
write16((uint16_t*)dest, info.addend + target - reloc->GetAddress());
30843091
break;
30853092
case R_AARCH64_PREL32:
3086-
dest32[0] = (uint32_t)(info.addend + target - reloc->GetAddress());
3093+
write32((uint32_t*)dest, info.addend + target - reloc->GetAddress());
30873094
break;
30883095
case R_AARCH64_PREL64:
3089-
dest64[0] = info.addend + target - reloc->GetAddress();
3096+
write64((uint64_t*)dest, info.addend + target - reloc->GetAddress());
30903097
break;
30913098
case R_AARCH64_P32_RELATIVE:
3092-
dest32[0] = target + info.addend;
3099+
write32((uint32_t*)dest, target + info.addend);
30933100
break;
30943101
case R_AARCH64_RELATIVE:
3095-
dest64[0] = target + info.addend;
3102+
write64((uint64_t*)dest, target + info.addend);
30963103
break;
30973104
case R_AARCH64_LDST8_ABS_LO12_NC:
30983105
{
@@ -3537,7 +3544,7 @@ extern "C"
35373544
{
35383545
BN_DECLARE_CORE_ABI_VERSION
35393546

3540-
#ifndef DEMO_VERSION
3547+
#ifndef DEMO_EDITION
35413548
BINARYNINJAPLUGIN void CorePluginDependencies()
35423549
{
35433550
AddOptionalPluginDependency("view_elf");
@@ -3546,7 +3553,7 @@ extern "C"
35463553
}
35473554
#endif
35483555

3549-
#ifdef DEMO_VERSION
3556+
#ifdef DEMO_EDITION
35503557
bool Arm64PluginInit()
35513558
#else
35523559
BINARYNINJAPLUGIN bool CorePluginInit()

arch/arm64/disassembler/format.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ uint32_t get_sme_tile(const InstructionOperand *operand, char *outBuffer, uint32
420420
if(operand->arrSpec == ARRSPEC_FULL)
421421
snprintf(base_offset, sizeof(base_offset), "[%s]", get_register_name(operand->reg[0]));
422422
else
423-
snprintf(base_offset, sizeof(base_offset), "[%s, #%llu]", get_register_name(operand->reg[0]), operand->immediate);
423+
snprintf(base_offset, sizeof(base_offset), "[%s, #%" PRIu64 "]", get_register_name(operand->reg[0]), operand->immediate);
424424
}
425425

426426
char *slice = "";
@@ -445,9 +445,9 @@ uint32_t get_indexed_element(const InstructionOperand *operand, char *outBuffer,
445445
// make the "{, #<imm>}"
446446
char optional_comma_and[32];
447447
if(operand->immediate)
448-
if(snprintf(optional_comma_and, 32, ", #%llu", operand->immediate) >= 32)
448+
if(snprintf(optional_comma_and, 32, ", #%" PRIu64 "", operand->immediate) >= 32)
449449
return FAILED_TO_DISASSEMBLE_OPERAND;
450-
450+
451451
// <Pn>.<T>[<Wm>{, #<imm>}]
452452
if(snprintf(outBuffer, outBufferSize, "%s%s[%s%s]",
453453
get_register_name(operand->reg[0]),
@@ -462,7 +462,7 @@ uint32_t get_indexed_element(const InstructionOperand *operand, char *outBuffer,
462462

463463
uint32_t get_accum_array(const InstructionOperand *operand, char *outBuffer, uint32_t outBufferSize)
464464
{
465-
if(snprintf(outBuffer, outBufferSize, "ZA[%s, #%llu]",
465+
if(snprintf(outBuffer, outBufferSize, "ZA[%s, #%" PRIu64 "]",
466466
get_register_name(operand->reg[0]), operand->immediate
467467
) >= outBufferSize)
468468
return FAILED_TO_DISASSEMBLE_OPERAND;
@@ -580,7 +580,7 @@ int aarch64_disassemble(Instruction *instruction, char *buf, size_t buf_sz)
580580
sizeof(tmpOperandString)) != DISASM_SUCCESS)
581581
return FAILED_TO_DISASSEMBLE_OPERAND;
582582
operand = tmpOperandString;
583-
break;
583+
break;
584584
case NAME:
585585
operand = instruction->operands[i].name;
586586
break;

arch/arm64/disassembler/sysregs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ const char *get_system_register_name(enum SystemReg sr)
264264
case 38944: return "dbgdtr_el0";
265265
case 38952: return "dbgdtrtx_el0";
266266
case 41016: return "dbgvcr32_el2";
267+
case 49157: return "mpidr_el1";
267268
case 49280: return "sctlr_el1";
268269
case 49281: return "actlr_el1";
269270
case 49282: return "cpacr_el1";

arch/arm64/disassembler/sysregs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ enum SystemReg {
259259
REG_DBGDTR_EL0=38944,
260260
REG_DBGDTRTX_EL0=38952,
261261
REG_DBGVCR32_EL2=41016,
262+
REG_MPIDR_EL1=49157,
262263
REG_SCTLR_EL1=49280,
263264
REG_ACTLR_EL1=49281,
264265
REG_CPACR_EL1=49282,

arch/armv7/arch_armv7.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3229,7 +3229,7 @@ extern "C"
32293229
{
32303230
BN_DECLARE_CORE_ABI_VERSION
32313231

3232-
#ifndef DEMO_VERSION
3232+
#ifndef DEMO_EDITION
32333233
BINARYNINJAPLUGIN void CorePluginDependencies()
32343234
{
32353235
AddOptionalPluginDependency("view_elf");
@@ -3238,7 +3238,7 @@ extern "C"
32383238
}
32393239
#endif
32403240

3241-
#ifdef DEMO_VERSION
3241+
#ifdef DEMO_EDITION
32423242
bool ARMv7PluginInit()
32433243
#else
32443244
BINARYNINJAPLUGIN bool CorePluginInit()

arch/armv7/il.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4874,7 +4874,7 @@ bool GetLowLevelILForArmInstruction(Architecture* arch, uint64_t addr, LowLevelI
48744874
il.DivUnsigned(get_register_size(op2.reg), ReadRegisterOrPointer(il, op2, addr), ReadRegisterOrPointer(il, op3, addr))));
48754875
break;
48764876
case ARMV7_VADD:
4877-
if((instr.dataType != DT_F32) && (instr.dataType != DT_F32) && (instr.dataType != DT_F64))
4877+
if((instr.dataType != DT_F32) && (instr.dataType != DT_F64))
48784878
break;
48794879

48804880
ConditionExecute(il, instr.cond,
@@ -4887,7 +4887,7 @@ bool GetLowLevelILForArmInstruction(Architecture* arch, uint64_t addr, LowLevelI
48874887
);
48884888
break;
48894889
case ARMV7_VDIV:
4890-
if((instr.dataType != DT_F32) && (instr.dataType != DT_F32) && (instr.dataType != DT_F64))
4890+
if((instr.dataType != DT_F32) && (instr.dataType != DT_F64))
48914891
break;
48924892

48934893
ConditionExecute(il, instr.cond,
@@ -4935,7 +4935,7 @@ bool GetLowLevelILForArmInstruction(Architecture* arch, uint64_t addr, LowLevelI
49354935
}
49364936
break;
49374937
case ARMV7_VMUL:
4938-
if((instr.dataType != DT_F32) && (instr.dataType != DT_F32) && (instr.dataType != DT_F64))
4938+
if((instr.dataType != DT_F32) && (instr.dataType != DT_F64))
49394939
break;
49404940

49414941
ConditionExecute(il, instr.cond,
@@ -4957,7 +4957,7 @@ bool GetLowLevelILForArmInstruction(Architecture* arch, uint64_t addr, LowLevelI
49574957
});
49584958
break;
49594959
case ARMV7_VSUB:
4960-
if((instr.dataType != DT_F32) && (instr.dataType != DT_F32) && (instr.dataType != DT_F64))
4960+
if((instr.dataType != DT_F32) && (instr.dataType != DT_F64))
49614961
break;
49624962

49634963
ConditionExecute(il, instr.cond,

arch/armv7/test_lift.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@
122122
('T', b'\x41\xf3\x41\x00', 'LLIL_SET_REG.d(r0,LLIL_ASR.d(LLIL_LSL.d(LLIL_REG.d(r1),LLIL_CONST.b(0x1D)),LLIL_CONST.b(0x1E)))'),
123123
# sbfx r0, r1, 20, 30 (starting at b20, width 30... gets clamped, so b31b30...b20
124124
# just r0 = r1 >> 20, no left shift required
125-
('T', b'\x41\xf3\x1d\x50', 'LLIL_SET_REG.d(r0,LLIL_ASR.d(LLIL_REG.d(r1),LLIL_CONST.b(0x14)))')
125+
('T', b'\x41\xf3\x1d\x50', 'LLIL_SET_REG.d(r0,LLIL_ASR.d(LLIL_REG.d(r1),LLIL_CONST.b(0x14)))'),
126+
# rev r1, r1
127+
('T', b'\x09\xba', 'LLIL_SET_REG.d(r1,LLIL_OR.d(LLIL_LSR.d(LLIL_REG.d(r1),LLIL_CONST.d(0x18)),LLIL_OR.d(LLIL_LSL.d(LLIL_AND.d(LLIL_LSR.d(LLIL_REG.d(r1),LLIL_CONST.d(0x10)),LLIL_CONST.d(0xFF)),LLIL_CONST.d(0x8)),LLIL_OR.d(LLIL_LSL.d(LLIL_AND.d(LLIL_LSR.d(LLIL_REG.d(r1),LLIL_CONST.d(0x8)),LLIL_CONST.d(0xFF)),LLIL_CONST.d(0x10)),LLIL_LSL.d(LLIL_AND.d(LLIL_REG.d(r1),LLIL_CONST.d(0xFF)),LLIL_CONST.d(0x18))))))'),
126128
]
127129

128130
import re

0 commit comments

Comments
 (0)