diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eed4d7a19a..1c1d86b3fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -138,6 +138,8 @@ jobs: path: binr/blob/radare2.xz - name: Static static r2 with meson run: | + sudo apt-get --assume-yes install python3-wheel python3-setuptools + sudo pip3 install meson==0.55.3 ninja==1.10.0 CFLAGS="-static" LDFLAGS="-static" meson --prefix=${HOME}/.local --buildtype release --default-library static build ninja -C build && ninja -C build install - name: Pub diff --git a/dist/plugins-cfg/plugins.static.cfg b/dist/plugins-cfg/plugins.static.cfg index 83a44bf21c..85c90f7677 100644 --- a/dist/plugins-cfg/plugins.static.cfg +++ b/dist/plugins-cfg/plugins.static.cfg @@ -4,7 +4,6 @@ STATIC="anal.8051 anal.arc anal.arm_cs anal.arm_gnu -anal.avr anal.i4004 anal.bf anal.chip8 @@ -40,7 +39,6 @@ asm.8051 asm.arc asm.arm_cs asm.arm_gnu -asm.avr asm.bf asm.chip8 asm.cris_gnu @@ -116,7 +114,6 @@ bin.pe64 bin.pebble bin.smd bin.sms -bin.avr bin.sfc bin.te bin.vsf @@ -216,7 +213,6 @@ lang.vala parse.6502_pseudo parse.arm_pseudo parse.att2intel -parse.avr_pseudo parse.chip8_pseudo parse.dalvik_pseudo parse.m68k_pseudo diff --git a/dist/plugins-cfg/plugins.static.nogpl.cfg b/dist/plugins-cfg/plugins.static.nogpl.cfg index 481e9e65fe..d379765e12 100644 --- a/dist/plugins-cfg/plugins.static.nogpl.cfg +++ b/dist/plugins-cfg/plugins.static.nogpl.cfg @@ -4,7 +4,6 @@ STATIC="anal.8051 anal.arc anal.arm_cs anal.arm_gnu -anal.avr anal.i4004 anal.bf anal.chip8 @@ -37,7 +36,6 @@ asm.8051 asm.arc asm.arm_cs asm.arm_gnu -asm.avr asm.bf asm.chip8 asm.cris_gnu @@ -109,7 +107,6 @@ bin.pe64 bin.pebble bin.smd bin.sms -bin.avr bin.sfc bin.te bin.vsf @@ -197,7 +194,6 @@ parse.dalvik_pseudo parse.m68k_pseudo parse.mips_pseudo parse.sh_pseudo -parse.avr_pseudo parse.wasm_pseudo parse.x86_pseudo parse.z80_pseudo" diff --git a/libr/anal/p/anal_avr.c b/libr/anal/p/anal_avr.c index cdad5d3d01..3fd903fab9 100644 --- a/libr/anal/p/anal_avr.c +++ b/libr/anal/p/anal_avr.c @@ -1597,10 +1597,10 @@ OPCODE_DESC opcodes[] = { INST_LAST }; -static void set_invalid_op(RAnalysisOp *op, ut64 addr) { +static void set_invalid_op(RAnalOp *op, ut64 addr) { // Unknown or invalid instruction. - op->family = R_ANALYSIS_OP_FAMILY_UNKNOWN; - op->type = R_ANALYSIS_OP_TYPE_UNK; + op->family = R_ANAL_OP_FAMILY_UNKNOWN; + op->type = R_ANAL_OP_TYPE_UNK; op->addr = addr; op->nopcode = 1; op->cycles = 1; diff --git a/libr/asm/arch/avr/avr_instructionset.h b/libr/asm/arch/avr/avr_instructionset.h new file mode 100644 index 0000000000..cf15589a3a --- /dev/null +++ b/libr/asm/arch/avr/avr_instructionset.h @@ -0,0 +1,34 @@ +#ifndef AVR_DISASSEMBLER_INSTRUCTIONSET_H +#define AVR_DISASSEMBLER_INSTRUCTIONSET_H + +#include + +/* Total number of assembly instructions, Maximum number of operands */ +#define AVR_TOTAL_INSTRUCTIONS 145 +#define AVR_MAX_NUM_OPERANDS 2 + +/* Enumeration for all types of AVR Operands */ +enum AVR_Operand_Types { + OPERAND_NONE, OPERAND_REGISTER_GHOST, + OPERAND_REGISTER, OPERAND_REGISTER_STARTR16, + OPERAND_REGISTER_EVEN_PAIR, OPERAND_REGISTER_EVEN_PAIR_STARTR24, + OPERAND_BRANCH_ADDRESS, OPERAND_RELATIVE_ADDRESS, OPERAND_LONG_ABSOLUTE_ADDRESS, + OPERAND_IO_REGISTER, OPERAND_DATA, OPERAND_DES_ROUND, OPERAND_COMPLEMENTED_DATA, OPERAND_BIT, OPERAND_WORD_DATA, + OPERAND_X, OPERAND_XP, OPERAND_MX, + OPERAND_Y, OPERAND_YP, OPERAND_MY, OPERAND_YPQ, + OPERAND_Z, OPERAND_ZP, OPERAND_MZ, OPERAND_ZPQ, +}; + +/* Structure for each instruction in the instruction set */ +struct _instructionInfo { + char mnemonic[7]; + /* Bitwise AND mask for just the instruction bits */ + uint16_t opcodeMask; + int numOperands; + /* Bitwise AND mask for each operand in the opcode */ + uint16_t operandMasks[AVR_MAX_NUM_OPERANDS]; + int operandTypes[AVR_MAX_NUM_OPERANDS]; +}; +typedef struct _instructionInfo instructionInfo; + +#endif /* AVR_DISASSEMBLER_INSTRUCTIONSET_H */ \ No newline at end of file diff --git a/libr/asm/arch/avr/disasm.h b/libr/asm/arch/avr/disasm.h new file mode 100644 index 0000000000..2822e90c9c --- /dev/null +++ b/libr/asm/arch/avr/disasm.h @@ -0,0 +1,6 @@ +#ifndef AVR_DISASSEMBLER_H +#define AVR_DISASSEMBLER_H + +int avr_decode (char *out, ut64 addr, cut8 *buf, int len); + +#endif /* AVR_DISASSEMBLER_H */ \ No newline at end of file diff --git a/libr/bin/bfile.c b/libr/bin/bfile.c index e6c68454e0..9fa2f88998 100644 --- a/libr/bin/bfile.c +++ b/libr/bin/bfile.c @@ -165,7 +165,7 @@ static int string_scan_range(RList *list, RBinFile *bf, int min, if (is_wide32) { str_type = R_STRING_TYPE_WIDE32; } else { - bool is_wide = needle + rc + 2 < to && !w[0] && w[1] && !w[2]; + bool is_wide = needle + rc + 4 < to && !w[0] && w[1] && !w[2] && w[3] && !w[4]; str_type = is_wide? R_STRING_TYPE_WIDE: R_STRING_TYPE_ASCII; } } else { diff --git a/test/db/anal/avr b/test/db/anal/avr index b28fa83e88..47e00f8972 100644 --- a/test/db/anal/avr +++ b/test/db/anal/avr @@ -617,10 +617,10 @@ EXPECT=<