esaulenka / ghidra_v850

Ghidra support for Renesas V850 MCUs
MIT License
60 stars 25 forks source link

V850e3: fix decompilation of ld.hu as bcond #21

Closed pd0wm closed 1 year ago

pd0wm commented 1 year ago

Think there is a typo in the opcode for bcond (b.<cond>/br). Since bit 15 is not specified there is ambiguity between ld.hu[reg1], r16 and the branch instructions.

Before this change: e5 87 1d fb br LAB_0007a76a

after: e5 87 1d fb ld.hu -0x4e4[tp],r16

objdump output:

v850-elf-objdump -b binary  -D out.bin -m v850e3v5
e5 87 1d fb     ld.hu    -1252[r5], r16
esaulenka commented 1 year ago

Yes, you are right. Also according to this opcodes list 15th bit should be a fixed part of BR opcode.

Thanks, Willem. Btw, congrats on success with next steering ECU hacking. Cool work!