Commit Graph

2514 Commits

Author SHA1 Message Date
Sergi Àlvarez i Capilla
11eb7cb350 Fix redefine warning 2022-02-08 20:53:45 +01:00
Nerijus Bendžiūnas
71d7bf2bcd Add RISC-V CSR related instruction descriptions 2022-02-02 17:38:02 +01:00
lasek0
a12795d180 Workaround to handle seg:off on x86_16 due to a capstone bug ##disasm
* Add tests showing the computed absolute address or label
2022-01-31 01:46:39 +01:00
pancake
5e92a476cb
Merge asm.msp430 into anal (#19639) 2022-01-28 20:38:29 +01:00
Sylvain Pelissier
0698f0b8f9
Remove asm.m68k and merge disasm into the anal (#19637) 2022-01-28 09:30:15 +01:00
Sylvain Pelissier
61b2667d77
Remove asm.6502_cs and merge disasm into the anal (#19632) 2022-01-26 16:37:19 +01:00
pancake
54b1fcd23c
Add CI job to verify builds with system-wide capstone ##build 2022-01-26 09:49:36 +01:00
pancake
d3d0e8f3ec Mark all globals (or most of them) as TLS variables ##core 2022-01-21 17:04:56 +01:00
pancake
f2995c2949
Introduce r_strf and stop using sdb_fmt ##util 2022-01-18 18:35:31 +01:00
Sergi Àlvarez i Capilla
5a024f10fe Fix UBSAN in armass64 when shifting a signed variable
* runtime error: left shift of 128 by 29 places cannot be represented in type 'int'
2022-01-14 12:42:04 +01:00
Sergi Àlvarez i Capilla
e8fea8f2d1 Add arc.mk in shared builds 2022-01-14 12:30:51 +01:00
pancake
6ae845c991
Move asm/wasm into anal, and add new opasm() callback ##abi
* ABI break for all anal plugins
2022-01-09 22:55:34 +01:00
Sergi Àlvarez i Capilla
ab1e0de94c Remove asm.hexagon, anal one is enough ##refactor 2022-01-07 03:24:07 +01:00
Sergi Àlvarez i Capilla
ffcca7dfb5 Increase local buffer to avoid some scary long instruction truncation 2022-01-07 01:07:04 +01:00
Sergi Àlvarez i Capilla
75f813a4a9 Update tests and help about asm.leahints -> asm.hint.lea 2022-01-07 00:56:27 +01:00
Sergi Àlvarez i Capilla
478c7d2d1d Fix capstone v5 regression 2022-01-07 00:56:27 +01:00
Sergi Àlvarez i Capilla
d7117df242 Do not use sdb_fmt in arm.cs plugin 2022-01-06 23:21:00 +01:00
Sergi Àlvarez i Capilla
1eaee48370 Initial implementation of the 'aafs' command ##analysis
* Find function entrypoints and creates a single basic block function
* Useful for fast initial analysis instead of aaa (30min vs 5s)
* Handy to get xrefs context in function boundaries
2021-12-23 18:58:38 +01:00
junchao-loongson
efd05bc7e9
Add support for the new loongarch architecture ##analysis
* Disasm, emulation, analysis and ELF support updated
2021-12-23 12:37:29 +01:00
Lazula
ad749a0b1a Fix static/R_API function definition formatting
* Remove spaces before parens
* Remove spaces after asterisks
2021-12-21 20:58:12 +01:00
pancake
575c26f329 Fix some format string warnings in the mingw ci job 2021-12-21 00:31:28 +01:00
pancake
eb5d38e34d Finish the dechip from asm 2021-12-17 12:11:05 +01:00
pancake
681323267d
Refactor, improve and move chip8 support out of libr/asm ##asm 2021-12-17 11:21:52 +01:00
pancake
d24bf5b654 More build fixes, googlefuzz integration, add r_asm_cpus() api via the wip 'al' command 2021-12-17 00:15:38 +01:00
pancake
9986b6e464
Remove asm.ebc and merge disasm into the anal ##refactor 2021-12-16 18:27:45 +01:00
Sergi Àlvarez i Capilla
cc217494b2 Disable the disassembler logic in the asm plugin for 8051 ##asm
* Avoid compile+link the same code twice for asm & anal
2021-12-14 10:16:58 +01:00
Sergi Àlvarez i Capilla
350c269901 Bind anal into rasm2 2021-12-14 00:32:45 +01:00
gogo2464
720f7f86c7
Handle registers on push on 8051 ##assembler 2021-12-13 23:45:18 +01:00
Sergi Àlvarez i Capilla
4982055f30 Fix the last covs reported in pyc/avr/aao 2021-12-13 23:07:41 +01:00
gogo2464
fbb32d6875
Avoid UB in 8051 assembler and improve error message 2021-12-12 22:53:42 +01:00
pancake
2ddcdea581 Use cs_disasm_iter in anal.x86.cs to use less heap ##analysis 2021-12-12 21:48:09 +01:00
pancake
2e49776cce Use cs_disasm_iter to save few allocations ##disasm 2021-12-12 21:48:09 +01:00
gogo2464
d6d100938c
Handle jbc [reg] in 8051 assembler ##asm 2021-12-12 20:43:30 +01:00
pancake
49f40816d3 Fix indent issues, pass out buffer size and fix disasm return value 2021-12-09 09:51:29 +01:00
gogo
2f950f5ebe add registers sreg, adcl and adch
replace spaces by tabs and add registers rampz and eind

remove comments from avr analysis plugin

add some registers to the register list

add more registers

add more registers

ajust register sizes

list all remininders full registers

analyze the binary

check for environment variable to fix tests

Use r_str_get() instead of manual string null checks in AVR plugin

move sreg instruction in numerical order

split the .assemble function with new files assemble.c and assemble.h

reassemble new instructions with operand spl and sreg

can reassemble old hex input as well as new input with register names. Register sph added.

use r_strbuf apis

Add file disassemble.c to meson

Fix is_register_found is ONLY set to true when current_register is != NULL

Fix size logic on return value.

Modify tests

fix review
2021-12-09 09:51:29 +01:00
pancake
08f66e3daa Fix #19464 - incorrect assembly for adrp on arm64 ##asm 2021-12-05 16:29:11 +01:00
pancake
e9b8b4fb66
Use null plugin when using unexistent asm plugin ##asm
* Fixes anal disasm warnings and related problems
2021-12-05 11:53:31 +01:00
Sergi Àlvarez i Capilla
0290c24758 Fix r2pm -s when more than one result is found. 2021-12-03 12:29:39 +01:00
pancake
a0d003ba53
Initial support for VLIW on hexagon ##disasm 2021-12-03 01:39:26 +01:00
pancake
e6f2cd0b2a
Remove trailing spaces (#19460)
$ git grep ' $' | grep -v ^test/ | cut -d : -f 1 | sort -u > /tmp/trailing
$ for a in `cat /tmp/trailing` ; do sed -i -e 's/ *$//' $a ; done
2021-12-02 17:39:59 +01:00
condret
c80d1dd49a Fix meson-linux-spaces build 2021-11-24 19:29:16 +01:00
slowhand99
652c24b096 Changes to be committed:
modified:   meson.build
2021-11-24 19:29:16 +01:00
slowhand99
ba1a0c1134 Changes to be committed:
modified:   libr/asm/meson.build
2021-11-24 19:29:16 +01:00
condret
081d6f903c Use r_strbuf_setf instead of sdb_fmt in jd8dis.c 2021-11-24 19:29:16 +01:00
condret
5c3f647180 Fix meson build 2021-11-24 19:29:16 +01:00
Ashwin Kumar
850e4a0806 Update libr/asm/arch/jdh8/jdh8dis.c
Co-authored-by: pancake <pancake@nowsecure.com>
2021-11-24 19:29:16 +01:00
slowhand99
32f5322756 Replace sdb_fmt with snprintf
modified:   libr/asm/arch/jdh8/jdh8dis.c
2021-11-24 19:29:16 +01:00
slowhand99
8156f33083 Implemented suggested changes modified: jdh8dis.c 2021-11-24 19:29:16 +01:00
slowhand99
b6e7f437c5 Implemented suggested modifications
modified:   libr/asm/arch/jdh8/jdh8dis.c
2021-11-24 19:29:16 +01:00
slowhand99
3776e618a7 Changes to be committed:
modified:   libr/asm/p/asm_jdh8.c
	Updated TODO
2021-11-24 19:29:16 +01:00
slowhand99
6b519408d5 Changes to be committed:
modified:   asm/arch/jdh8/jdh8dis.c
	Updated TODO
2021-11-24 19:29:16 +01:00
slowhand99
6b9d11908d Changes to be committed:
modified:   asm/arch/jdh8/jdh8dis.c
	Updated TODO
2021-11-24 19:29:16 +01:00
condret
7345d1f5e1 Fix build and codingstyle for jdh-8 disassembler 2021-11-24 19:29:16 +01:00
slowhand99
8c861b38f2 Changes to be committed:
modified:   libr/asm/arch/jdh8/jdh8dis.c
2021-11-24 19:29:16 +01:00
slowhand99
cd1b1aaeec Changes to be committed:
modified:   libr/asm/arch/jdh8/jdh8dis.c
2021-11-24 19:29:16 +01:00
slowhand99
a38f37dd23 Changes to be committed:
modified:   libr/asm/arch/jdh8/jdh8dis.c
2021-11-24 19:29:16 +01:00
slowhand99
bed0bac310 Changes to be committed:
modified:   jdh8dis.c
2021-11-24 19:29:16 +01:00
condret
67db06009f Add jdh-8 asm-plugin template 2021-11-24 19:29:16 +01:00
Lazula
2255bf8b5d Many indentation style fixes
* Change several 8-space indents to tabs
* Apply tab indent style when breaking long lines
* Move operators from EOL to start of next line
* Fix ternary formatting
2021-11-18 10:43:52 +01:00
pancake
7362d74ae4
Use more join_paths along the meson 2021-11-14 22:25:05 +01:00
pancake
07a4b25adc Dont sync capstone all the time 2021-11-05 10:08:23 +01:00
Sergi Àlvarez i Capilla
55dfb5cae8 Fix metadata for some asm/anal ARM plugins 2021-10-28 13:16:12 +02:00
Sergi Àlvarez i Capilla
33243ea7f4 Update v35.armv7 dependency in preconfigure
* Fix build on Termux and Gitlab CI
2021-10-26 20:39:42 +02:00
pancake
e8d4e5cc9f
Fix the windows build regressions 2021-10-19 22:17:47 +02:00
pancake
fdde9caaad
Fix builds issues on meson, windows, ios, static and wasi 2021-10-19 20:57:19 +02:00
pancake
6ae90339fd
Add armv7 to the arm.v35 plugin ##disasm 2021-10-19 20:21:36 +02:00
Sergi Àlvarez i Capilla
8f31696ae2 Update to the latest v35-arm64 for mingw 2021-10-19 18:01:11 +02:00
Sergi Àlvarez i Capilla
77fcda89aa Static build fix 2021-10-19 15:15:01 +02:00
pancake
3548e2e8a4 Final mingw fixes 2021-10-19 12:52:00 +02:00
Sergi Àlvarez i Capilla
98a0bfaf84 Fix crash when using the pyc disassembler without pyc bin ##anal 2021-10-15 02:51:24 +02:00
pancake
58312182e8
Add the first multiarch assembler plugin: vasm ##asm 2021-10-12 21:49:11 +02:00
Lazula
0747bcd8e2 Fix new defects in various files
* Remove unnecessary NULL check in __demangleAs()
* Remove unnecessary NULL check in r_io_fd_seek()
* Add missing break in ARM32 COFF case and fix test
* Add missing NULL checks for r_io_bank_get() result
* Add missing NULL checks in r_bin_demangle()
* Add missing NULL check for r_io_submap_new() result
* Fix improper failure check in risv_assemble()
* Add missing break in open command
* Document fall-through case in dalvik anal
2021-10-08 01:31:17 +02:00
pancake
ba7ac2b853
Add support for the ALPHA disassembler ##disasm 2021-10-01 19:16:03 +02:00
pancake
e8e9cef1e2
Initial implementation of the RISCV assembler ##asm (#19144) 2021-09-28 11:18:23 +02:00
pancake
e3e64df6f3
Add PDP-11 disassembler support from binutils ##disasm (#19141) 2021-09-27 14:22:22 +02:00
pancake
9f53609621 Update v35 disassembler again 2021-09-22 16:09:35 +02:00
pancake
1c9432c849
Remove few plugins from the meson build to make windows happy (#19064)
The latest linker seems to add some a symbol in an include file, better disable those plugins for now
2021-09-09 20:28:57 +02:00
Adwaith V Gautham
c6c498455f
Fix #19019 - Added OT_GPREG flag to instructions with byte, word, qword etc ##asm
* Updated code for a few x86 instructions and added tests for the same
2021-09-01 01:04:23 +02:00
pancake
a0a753d741 Fix #19004 - Use a specific commit for the v35arm64 disassembler ##build 2021-08-23 22:30:57 +02:00
pancake
fd3870c437 Implement bne instruction in the arm64 assembler ##asm 2021-08-20 14:39:59 +02:00
pancake
06a1270df7
Add meson support for the anal.arm.v35 plugin ##build 2021-08-18 03:35:01 +02:00
pancake
18011597c4
Fix more sign bugs spotted by vs (#18990) 2021-08-17 23:12:22 +02:00
pancake
8a78055996
Fix all the sign UB bugs in the risc disassembler spotted by VS (#18986) 2021-08-17 02:09:49 +02:00
pancake
0acb19b68a
Fix some warnings spotted by visual studio (#18985)
Co-authored-by: pancake <pancake@nopcode.org>
2021-08-16 20:45:17 +02:00
pancake
04483ee801
Initial import of ./preconfigure for packaging purposes ##build
* Use git clone -q for a quieter experience
2021-07-31 02:48:40 +02:00
Murphy
3ed52d4d26
Fix #18813 - Cannot assemble cmp w26, 0 in arm64 ##asm 2021-07-30 12:56:01 +02:00
Murphy
5e608cf01f
Fix #18876 - Check imm bounds for some instructions in the x86.nz assembler ##asm
* Add immediate_out_of_range function
* Add range limit to out imm8 instruction
* check imm range in opmov
2021-07-30 11:26:32 +02:00
pancake
35209b643e Add pushf/popf instructions to x86.nz ##asm 2021-07-30 01:23:03 +02:00
pancake
71f6069a46
Use NULL disassembler in the NULL asm plugin (#18945) 2021-07-28 12:09:36 +02:00
pancake
5a52e815ec
Use RAnalBind in RAsm to reuse RAnalPlugins to disassemble ##asm 2021-07-25 22:44:47 +02:00
pancake
3c416c54cc
Fix meson build and proper use of cgen ##build (#18920) 2021-07-21 17:22:39 +02:00
Alex Bender
82c16f9325
Update ARM64 arm.sdb.txt opcode descriptions from documentation ##asm 2021-07-18 18:43:59 +02:00
pancake
e5fcf4a518
Rebuild v35 disassembler once (#18902) 2021-07-16 02:32:20 +02:00
pancake
cc44d30309
Fix some issues spotted by msvc (#18899) 2021-07-15 17:24:05 +02:00
pancake
aaaa85a4dd Use -fPIC for arm64v35 libfiles 2021-07-15 17:21:33 +02:00
pancake
d1d9f7f774
Initial import of the arm64v35 disassembler and analysis plugins ##anal (#18753) 2021-07-15 12:08:41 +02:00
pancake
2e417ee938
Initial support for capstone-less compilations ##build 2021-06-21 17:48:00 +02:00
pancake
7631039d88 Fix windows build 2021-06-20 17:13:28 +02:00
pancake
ff6bd5a99c Update the VAX disassembler from binutils ##asm 2021-06-20 17:13:28 +02:00
pancake
af0a6ae98e
Fix #18825 - Invalid/unknown/unsupported instructions on the arm64 assembler must fail (#18826) 2021-06-10 23:29:06 +02:00
Sergi Àlvarez i Capilla
f8fc890b69 Fix aod (opcode description) when using the r2ghidra asm plugin 2021-06-09 21:11:05 +02:00
Sergi Àlvarez i Capilla
afcbdf90da Describe callt instruction for v850 2021-06-09 12:40:13 +02:00
Sergi Àlvarez i Capilla
151ab6d774 Add missing stp/ldp arm64 instruction descriptions 2021-06-06 12:25:09 +02:00
pancake
a18f73b3f2
Simplify some meson (#18768) 2021-05-28 01:35:55 +02:00
pancake
46ec83c5a0
Add use_cgen meson option ##build (#18766) 2021-05-27 23:56:28 +02:00
pancake
f0cea42855
Update sdb again to fix the missing gperf warning (#18761) 2021-05-27 18:31:29 +02:00
Murphy
2b5bf5ab7a
Fix #18619 - Wrong assembly generated for: "add x0, x0, 1, lsl #12" (ARM64) ##asm 2021-05-26 23:43:44 +02:00
pancake
d80476b698
Update SDB: Use the thin cgen instead of gperf (#18752) 2021-05-25 16:14:35 +02:00
pancake
a4b80d0b25 commandline -> command-line 2021-05-25 10:51:18 +02:00
pancake
4d629aee72
Fix disasm alignment of data words in s390x disassembler plugins ##anal (#18746) 2021-05-24 20:26:24 +02:00
pancake
5da2f97e62
Fix s390.gnu disassembly and add test for 6 byte instructions ##anal (#18744) 2021-05-24 17:04:18 +02:00
pancake
c3953d64d6
Use gperf on anal/d and improve build and checks ##anal
* Add --without-gperf configure flag
* Update sdb to support gperf.foreach and faster ls.sort()
* Support cc and types sdb gperfs
* add r_str_newvf
* Honor HAVE_GPERF in more places
* Add CI job to build and test cmds with gperf
2021-05-20 00:22:20 +02:00
pancake
08a8ab6eee
Use gperf in util/charset (#18672)
Co-authored-by: pancake <pancake@nopcode.org>
2021-05-11 11:21:02 +02:00
pancake
708e5c986c Fix gas regression 2021-05-10 23:51:38 +02:00
pancake
57a9926b1f
Remove globals in cons/grep and random cleanup (#18671) 2021-05-10 11:56:08 +02:00
pancake
162e223028
Rename sysz to s390 and add the s390.gnu plugin from binutils 2.36 ##asm 2021-05-04 04:01:22 +02:00
murphy
0c835fe5cb Fix 1452312 Dereference after null check 2021-04-26 20:49:55 +02:00
murphy
6108230e8a Fix 1452313 Dereference before null check 2021-04-26 20:49:55 +02:00
pancake
b59ba1c507 Fix signature 2021-04-26 11:10:19 +02:00
pancake
143ac8d9e8 Boolify check_features() 2021-04-25 17:57:57 +02:00
pancake
1a87b2c04d
Collapse all opcode_*.c files into opcode_all.c ##build (#18627) 2021-04-25 03:05:35 +02:00
pancake
7546f34e57
Update sdb and use of SdbGperf in asm.d ##asm 2021-04-25 02:31:46 +02:00
pancake
2434c3ca74
Switch to Capstone5 as default ##asm (#18127)
* Add riscv for capstone5 in the meson
* Report capstone version in the asm plugins
* Many changes in the ppc analysis, seems like it's improved, (emulation quality and xrefs)
* Update all tests and report issues in capstone4 to upstream
* Fix-x86-16 test marked as broken as it needs better fix
2021-04-24 22:04:51 +02:00
pancake
612fc9b35a
Fix oobread bug in the GNU arm64 disassembler (#18612) 2021-04-21 18:10:12 +02:00
pancake
46fbda4183
Fix a couple of oobreads (#18610) 2021-04-21 14:46:31 +02:00
Rin
caf09b9264
Improve MIPS support(mips.gnu) by migrating new codes from binutils (#18579) ##disasm
* Refresh old files with current binutils (copyright notes are not updated for now)
* Add remain components from binutils-gdb
* Update original copyright messages
* Modify MIPS disassembler to match output style
* Try to fix wrong jalx argument decoding
* Fix a gs264e disassembling bug caused by wrong definition
* Fix MSVC compiling problem, and add original binutils commit info
* Add disasm_obj.arch assignment back
* Add missing space character in comment
2021-04-15 18:24:41 +02:00
pancake
ab295f224a
Improve python disassembler and binary parser ##bin (#18561)
* Fix segfault when loading pyc9 file
* Lowercase all instructions (user can later decide asm.ucase)
* Use 1 space, not 20, between instruction and arg
* Detect pyc3.9 bins, not loading properly yet
2021-04-11 01:38:49 +02:00
pancake
530c737d5d
Fix incorrect use of non-const strings and fiz zousans of warnings (#18544)
Co-authored-by: pancake <pancake@nopcode.org>
2021-04-06 12:45:19 +02:00
pancake
5a29fa2856 Fix oobread in 6502 2021-04-05 03:11:33 +02:00
pancake
0ace091ff4 Add possible asm.ppc.cpu values 2021-04-05 02:19:21 +02:00
pancake
c150dc489f
Honor asm.cpu for asm.arch=ppc.gnu ##disasm (#18543) 2021-04-04 22:17:17 +02:00
pancake
bcd9e0aea0
Add the m68k.gnu disassembler plugin ##disasm 2021-04-04 18:07:26 +02:00
murphy
dd46d3d359 Fix 1408737 Out-of-bounds write 2021-04-01 21:52:06 +02:00
Khairul Azhar Kasmiran
d248a2230a dcpu16/dis.c: Use snprintf/strncpy instead of sprintf/strcpy 2021-03-15 06:09:50 +01:00
Khairul Azhar Kasmiran
ded1bafab3 Fix some uninitialized and minor memleak issues 2021-03-15 02:24:16 +01:00
Khairul Azhar Kasmiran
621f90752b Fix overflow in dcpu16 and uninitialized warning in wasm 2021-03-15 02:24:16 +01:00
pancake
ffe9651dad Fix #17761 - Do not trim the "ptr " when asm.syntax=masm ##disasm 2021-02-27 02:33:19 +01:00
pancake
fba880de13 Fix regression 2021-02-06 03:30:53 +01:00
Alexis Ehret
1de2e070ef Refactor z80 assembler ##asm 2021-02-06 03:30:53 +01:00
Alexis Ehret
43aadf109d Random dead code cleanup 2021-02-06 03:30:53 +01:00
Khairul Azhar Kasmiran
3f18a68556 Fix strncpy truncation warnings 2021-02-06 03:30:53 +01:00
pancake
0131d7901a Code cleanup in c55x and random dead assignments deleted 2021-02-06 03:30:53 +01:00
pancake
8413fd630a Improve .fill and rasm2 -hh with documented directives ##asm 2021-02-04 01:03:58 +01:00
Kamil Rytarowski
9d761f6a88
Avoid array subscript type issues (#18295)
Cast char to unsigned char for standard reasons and security purposes.

Fixes build issues on NetBSD.
2021-01-26 13:08:58 +01:00
Anton Kochkov
ef462a4800 Some clang-format improvements ##indent
* Fix for clang-format parsing error
* Align consecutive macros for clang-format
* Dont align escaped newlines
* Use spaces for some alignment
* Add clang-format script
2021-01-25 00:34:58 +01:00
pancake
c889cbadf7
Fix build for capstone5 ##build (#18273) 2021-01-24 19:09:43 +01:00
pancake
0dbc4ee537 Add missing files and remaining patches from import 2021-01-19 05:37:17 +01:00
wargio
3de5f99e68 AVR: Fixed profile, (null) instruction and anal ##rizin 2021-01-19 05:37:17 +01:00
wargio
085125b4ba Fixed ACR build scripts to build AVR disassembler and anal plugins 2021-01-19 05:37:17 +01:00
wargio
cfcf4f86ac Fixed AVR anal plugin warning due unpopulated mnemonic ##rizin 2021-01-19 05:37:17 +01:00
Giovanni
5ffe3e4240 Fixing clang flow warnings (#321) ##rizin 2021-01-19 05:37:17 +01:00
Liumeo
c631443b9b
Remove strncat usage (#18229) ##refactor 2021-01-14 17:24:23 +01:00
Qijia Liu
1d62d7df13 Fix memleak in db/asm/arm_64 2021-01-14 00:05:56 +01:00
pancake
171b994831 Fix #18212 - Detect RISCV gdb servers ##debug 2021-01-13 13:30:07 +01:00
pancake
cd8040b8fd Fix CI badge 2021-01-13 01:43:35 +01:00
eagleoflqj
46b8a0cc4e sync to llvm, support orr alias 2021-01-12 23:00:13 +01:00
eagleoflqj
f5a2f9ee43 Fix arm64 movk, movn, movz 2021-01-12 23:00:13 +01:00
pancake
3ab33d119e Code cleanup and other minor refactoring changes 2021-01-09 17:38:54 +01:00
eagleoflqj
8b41ca1c7f Support sbfm/ubfm in arm64 ##asm 2021-01-09 12:37:37 +01:00
eagleoflqj
bccd9c4552 Initial support for arm64 asm extendtype ##asm 2021-01-08 09:31:56 +01:00
Liumeo
592b6b0ae8
Test arm part of arm.winedbg (#18132) 2020-12-29 10:14:02 +01:00
Liumeo
531cfd252e
Add missing license of be_arm.c (#18126) 2020-12-28 21:46:42 +01:00
Liumeo
9478b3a957
Add test and update arm.winedbg (#18117) ##asm 2020-12-28 20:56:52 +01:00
Liumeo
057854a0cd
Implement i4004 assembler ##asm (#18111) 2020-12-26 23:54:11 +01:00
ivan tkachenko
38f5804ecf Move breaks inside switch-case scopes
Update DEVELOPERS.md code style section and
refactor switch-cases across all code base.
2020-12-26 11:15:03 +01:00
ivan tkachenko
d5f651a59e Trailing whitespaces are getting in the way 2020-12-26 11:15:03 +01:00
Sylvain Pelissier
8ba20160e2
Update RISC-V ESIL with sign extention operator (#18109) ##esil 2020-12-26 11:14:23 +01:00
Lazula
f2976d3c7e
Use r_str_get_fail() throughout codebase ##refactor (#18079) 2020-12-21 08:51:44 +01:00
pancake
d3157e2ed3
Fix 32 critical COVs (UAF, UB and OOB) (#18077) 2020-12-21 01:10:22 +01:00
Liumeo
a2a4248763
fix arm32 db/asm/snes_16 (#18061) 2020-12-18 22:12:10 +01:00
Lazula
4a1a624318
Clean up r_num ##util ##refactor (#18049)
* Fix function spacing for r_num functions
* Remove r_num_ntohs
* Rename r_num_to_trits to r_num_to_ternary for
  consistency with surrounding code
* Rename trits to ternary in other files
* Fix spacing in test_contrbtree.c
2020-12-17 22:24:27 +01:00
Lazula
243bc871c3 Multiple refactors in io and util ##io ##util ##refactor
* Add r_io_map macros throughout code base
* Update string NULL-checking with renamed functions r_str_get() and r_str_getf()
* Change string NULL-checks throughout code base to use functions
* Add r_str_get_fail() to specify a custom string to return if NULL-check fails
* Mark JSON to be updated with PJ with "TODO PJ"
* Incidental style updates such as missing spaces
2020-12-13 05:09:13 +01:00
pancake
66ee24393a
Fix #15264 - Implement AND and BIC instructions in the ARM64 assembler ##asm (#18021)
Co-authored-by: pancake <pancake@nopcode.org>
Co-authored-by: Francesco Tamagni <mrmacete@protonmail.ch>
2020-12-12 16:55:48 +01:00
GustavoLCR
951f46c91f
Fix ARM MTE addg/subg and big endian decoding ##anal (#17995)
* ARM: Fix addg/subg instruction decoding
* ARM: Fix MTE intruction decoding in big endian mode
2020-12-06 18:40:13 +01:00
Jeroen Domburg
b782a02ae3
Fix buffer read callback on all gnu disassembler plugins (#17992) ##disasm 2020-11-29 19:41:57 +01:00
alimansfield2016
4955ef1bc6
Fix wdm instruction decoded as 16bit instead of 8bit (#17922) ##disasm
WDM is a two byte instruction incorrectly being decoded as a single byte.
Modified the table to correct this and updated the format string appropriately.
2020-11-29 01:24:27 +01:00
pancake
b8f37cb0c3 Add few tests for v850.gnu and fix instruction bounds ##disasm 2020-11-28 19:39:23 +01:00
pancake
fee00c7b88 Implement v850.gnu disassembler plugin ##disasm 2020-11-28 19:39:23 +01:00
Aswin C
af745780ef
Add instruction descriptions for tricore ##disasm (#17942)
* Add instruction descriptions for tricore ##disasm

Add instructino descriptions which appear when `e asm.describe` is turned on for tricore architecture

* Add tricore in meson.build

Updated meson.build to add tricore in the sdb_files being built

* Make the test more representative
2020-11-23 12:34:44 +08:00
Liumeo
c611bc89c9
Fix s390x db/asm/x86_64 (#17951) 2020-11-23 12:33:22 +08:00
Liumeo
25c7389e84
fix msvc warning LNK4217 (#17955) 2020-11-22 21:10:49 +01:00
Liumeo
c83d0e0c5f
Implement ppc assembler plugin ##port ##refactor (#17923)
* implement ppc assembler plugin
* reuse code
* update .travis.yml & Dockerfile
* support arm.as big endian
2020-11-20 19:20:14 +08:00
Liumeo
da50d751b7
Fix System Z ELF asm.arch & bits (#17936) 2020-11-19 11:43:14 +08:00
Anton Kochkov
5da1b3b076 Fix some warnings 2020-11-16 18:56:21 +08:00
Liumeo
d4519ef324
Fix msvc warning c4090 in z80 (#17883) 2020-11-01 01:15:13 +01:00
eagleoflqj
6279aa6301 fix travis arm64 db/asm/dalvik 2020-10-25 01:32:02 +02:00
eagleoflqj
9fb7fc3bcd fix travis arm64 db/tools/rasm2 2020-10-19 11:55:37 +02:00
Riccardo Schirone
81e487429f
Use -Wno-cpp to avoid errors on #warning (#17785) 2020-10-14 16:57:07 +08:00
Riccardo Schirone
1e58692071
Fix incorrect uses of printf-like functions ##refactor (#17648) 2020-10-13 16:26:15 +02:00
Riccardo Schirone
741d22ed61
Use -Werror when building in CI (#17781) 2020-10-13 12:42:57 +02:00
pancake
b42fe2c807
Complete v850 instruction descriptions ##asm (#17764)
Co-authored-by: pancake <pancake@nopcode.org>
2020-10-10 12:14:49 +08:00
pancake
c521a6290c
Move spc700 asm,bin plugins to radare2-extras ##asm (#17762)
Co-authored-by: pancake <pancake@nopcode.org>
2020-10-10 12:11:29 +08:00
plaets
452b3ce902
Fix #17746 (buffer overflow in brainfuck disassembler) ##asm (#17747) 2020-10-04 14:17:02 +02:00
Aswin C
fd99114bca
Rename asm.filter to asm.sub.names ##cons (#17737)
* Rename `asm.filter` to `asm.sub.names`
* Rename tests for `asm.filter`
2020-10-01 10:13:58 +08:00
Azox
1287f7443f
FIX ARM IT block ##anal (#17509)
* Fix asm/anal IT block for ARM
* Fix indent + missing spaces
* Fix ARM asm patch breaking test
* Remove forgotten debug printf
* Moved anal patch to separate function anal_ITblock()
* Changed to RIOBind + fix code based on comments
* Fix issue with io/rasm
* Switched to HT, still need to invalidate HT
* Add routine to track and clean ITblock

Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
2020-09-30 13:45:01 +08:00
junchao-loongson
ca9b6ac1a0
Set asm.cpu for mips.gnu derived from the ISA defined in the ELF ##bin (#17555) 2020-09-21 16:58:07 +02:00
Khairul Azhar Kasmiran
d9057505dc
Set RPATH/RUNPATH on r2 libs too if local (#17639) 2020-09-15 09:16:14 +02:00
Riccardo Schirone
3e3efcc005 Test compilation with various capstone versions ##build
Do not use #include <capstone/..>

This ensures compatibility with both capstone v3 and capstone as
installed on most distributions, where the pkg-config file of capstone
already adds -I/usr/include/capstone (with that dir directly containing
the headers).
2020-09-09 15:39:33 +02:00
pancake
410db8175b
x86.as is only suposed to work on x86, add env var for custom use ##asm (#17610)
Co-authored-by: pancake <pancake@nopcode.org>
Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
2020-09-09 16:41:28 +08:00
pancake
74c4a36656
Fix 'call start' register confusion warning ##asm (#17573)
Co-authored-by: pancake <pancake@nopcode.org>
2020-09-03 14:45:09 +08:00
Aswin C
f656ccc0ea
Added instruction descriptions for RISC-V ##asm (#17526) 2020-08-27 12:12:52 +08:00
b7f4c7545e
Append missing loongson 2e/2f entries in mips-dis.c and mybfd.h (#17400) 2020-08-14 13:18:05 +08:00
Dennis Goodlett
18c052c266
Fix #17414 heap overflow hackyArmAnal (#17425)
* Fix #17414 heap overflow hackyArmAnal

Co-authored-by: Dennis Goodlett <dennis@hurricanelabs.com>
2020-08-10 10:23:09 +02:00
Anton Kochkov
a94718304c
Do not use 0b... integer constants (#17421)
The form of 0b01101 appeared only in GCC 4.3.
It wasn't defined in the C standard and was only
an extension.
2020-08-08 18:10:11 +08:00
phakeobj
4c207712bd
Add hack for ARMv8 BTI instruction disassembly ##anal (#17371)
Co-authored-by: phakeobj <phakeobj@users.noreply.github.com>
2020-07-31 18:08:59 +08:00
phakeobj
1dbe43d83d
Fix #17135 - Support Memory Tagging Extension instructions ##anal (#17279)
Co-authored-by: phakeobj <phakeobj@users.noreply.github.com>
2020-07-23 16:15:12 +08:00
pancake
d441baad62
Fix latest COVs, remove dead code and unnecessary global variables (#17231)
Co-authored-by: pancake <pancake@nopcode.org>
2020-07-22 19:37:31 +08:00
Riccardo Schirone
2d160f2509
Avoid sdb double headers (#17249) ##build
* Avoid duplication of SDB headers in libr/include

SDB is an external project and as such it should live in shlr. However,
for simplicity in dealing with the include flags, the SDB headers were
copied in libr/include as well. This patch just keeps the SDB files
confined in shlr/sdb and make sure various r_* libs use the headers from
there.

* Fix pkgconfig file generation
2020-07-21 10:28:43 +02:00
Riccardo Schirone
a933ba8beb
Check length before disassembling cr16 instructions ##asm (#17290) 2020-07-16 20:48:20 +08:00
Riccardo Schirone
594b940b7c
Fixes some of the issues in Travis (#17267)
* Do not check with r_return_ if the convention is present

Let's just assume the NULL default in such a case, so that architectures
for which we don't have a defined calling convention can still be
processed somehow by the analysis code. It won't be precise, but it's
better than nothing.

Also add a warning message so users are aware when the calling
convention is not defined.

* Fix oob-read when # is at the end of the cmd string

* Do not set TMPDIR when the new value is the empty string

When TMPDIR is set to empty value, clang+ld behaves in weird ways and
you cannot compile files from within the r2 shell (e.g. when using #!c
or #!cpipe)

* Use meson and add -lasan to pkgconfig files when sanitizer are used
2020-07-16 20:47:30 +08:00
karliss
35e824bc55
Fix OOB access in z80 disasm for "OP [ixy+nn]" instructions. (#17268) 2020-07-14 11:58:16 +03:00
pancake
f061b49c14
Fix all the covs (memleaks) reported the 15th of this month (#17163) 2020-06-29 09:40:35 +02:00
Sylvain Pelissier
521db221f4
Improve analysis of compressed instructions and update instruction format (#17115) 2020-06-22 10:12:50 +02:00
Jerome-PS
aeca50166d
Adding support for BA2 ELF binaries ##bin (#17063)
* Adding support for BA2 CPU

* Code clean up

* Moving support for BA2 CPU to radare2-extras

Co-authored-by: Jerome-PS <Jerome-PS>
2020-06-16 10:10:01 +02:00
pancake
bd9a604a87
Check for return values in about ~50 method calls (#17025) 2020-06-15 11:24:43 +02:00
pancake
cea53c7112
Fix ~300 warnings in the pyc disasembler (#17071)
Co-authored-by: pancake <pancake@nopcode.org>
2020-06-15 17:16:04 +08:00
Aswin
b24f4f02d0
Update arm.sdb.txt: Added instruction descriptions for ARM (#17070) 2020-06-14 21:11:40 +02:00
pancake
160fc95e66
Use (void) instead of () in function signatures (#17026) ##refactoring
* Use (void) instead of () in function signatures
* Add test to avoid further contributions to commit the same mistake
2020-06-14 16:08:32 +02:00
pancake
84ecf9fff2
Fix all the coverities detected last month (#17060)
* Fix all the coverities detected last month

* Fix one more cov

* Fix build

* refix build

Co-authored-by: pancake <pancake@nopcode.org>
2020-06-14 13:21:57 +02:00
Riccardo Schirone
70e3d3bc56
Fix compiler warnings (#17046) 2020-06-12 10:26:55 +02:00
Anton Kochkov
ffe743ef39
Fix #4056 - rename DEPS to R2DEPS ##build (#17020)
* Rename DEPS to R2DEPS
* Cleanup of sys/build.sh
2020-06-12 10:49:28 +08:00
pancake
9978bbd7c5
Implement assembler endbr32 and endbr64 instructions for x86-32/64 (#17035) ##asm
Co-authored-by: pancake <pancake@nopcode.org>
2020-06-10 19:15:46 +08:00
condret
ae883f0cd3 Cleaning up again 2020-06-10 02:24:03 +02:00
condret
6fe90763f5 Some cleanup 2020-06-10 02:24:03 +02:00
condret
c5a2a6562e fix #16995, #16994 and some other stuff 2020-06-10 02:24:03 +02:00
Giovanni
d2e6b41e53
Fix pre c99 loop issue and useless negative check (#16957)
Co-authored-by: Giovanni Dante Grazioli <giovanni.dantegrazioli@nbs-system.com>
2020-05-27 12:44:21 +02:00
Sean Maher
bb2d205ff2
Implement Wasm SIMD instruction disassembly (#16928) 2020-05-22 13:58:56 +02:00
FXTi
07dd91c973
FIX (#16839) 2020-05-17 14:23:35 +02:00
FXTi
8de388dc52
Fix Pyc issues from Infer and Coverity (#16828)
* Fix issues from infer and coverity
* Fix memory leaking by human eyes
2020-05-16 12:00:11 +08:00
FXTi
1ffdedcd07
Add Python bytecode plugins (#16771) 2020-05-13 10:37:09 +08:00
atodekangae
b18529696c Fix assembling of xchg so that it roundtrips 2020-04-29 00:13:25 +02:00
atodekangae
60fbd0b83a Fix assembling of xchg and the tests for it 2020-04-29 00:13:25 +02:00
atodekangae
e40e51d2ce Fix assembling of bswap r8(d)-r15(d) 2020-04-29 00:13:25 +02:00
Liumeo
7ffb7cf77a
Do not redefine assert in dis.c (#16694) 2020-04-28 19:35:29 +02:00
atodekangae
f1e113ca8f
Fix assembling of pop r8-r15 (#16710) 2020-04-24 18:40:09 +02:00
Anton Kochkov
38e6e39317
Move inferior GNU Hexagon plugin to extras (#16661) ##asm 2020-04-24 11:38:30 +02:00
Khairul Azhar Kasmiran
123aa79117
x86_64: Support mov r64, 0xffffffffffffffff (#16630) ##asm 2020-04-23 19:30:35 +02:00
pancake
a3407a535b
Cleanups for RAsm, rasm2 related to brainfuck hacks 2020-04-20 16:02:08 +02:00
Khairul Azhar Kasmiran
4afa4296ea
x86_32/64: Don't assemble overlarge MOV imm32 (#16619) 2020-04-17 22:36:58 +08:00
Liumeo
b5d5e00f66
Fix LGTM alert - remove strlen (#16615) 2020-04-17 08:49:45 +08:00
Liumeo
2570a7b001
Add header guard (#16605) 2020-04-16 18:41:31 +02:00
Khairul Azhar Kasmiran
538563149b
x86_64: Fix MOV r32, -imm32 encoding (#16609) ##asm 2020-04-16 16:30:32 +02:00
Khairul Azhar Kasmiran
a275bad0db
x86_64: Fix REX.B for MOV r64-extended, imm32/64 (#16602) 2020-04-16 13:23:02 +08:00
Liumeo
b9786ac7e3
Add header guards in the include files (#16595) 2020-04-15 12:20:02 +08:00
Khairul Kasmiran
7b4bee8cff x86_64: Add some tests and remove some unused MOV C7 code 2020-04-14 23:48:47 +02:00
Khairul Azhar Kasmiran
a43831ba96 Fix #16433 - Use MOV opcode B8+ for MOV r64, <0x80000000 to 0xffffffff> #16572 ##asm
Detailed description

I've confirmed #16433 (comment) (including the nasm rax -> eax bug) and thus this pr
makes the x86_64 assembler use the MOV B8+ encoding (MOV r64, imm64) when the immediate
is between 0x80000000 and 0xffffffff for both:

Consistency with GNU assembler.  It actually does seem to be the expected encoding.
This does mean that mov eax, 0xffffffff and mov rax, 0xffffffff will have very different semantics.
2020-04-13 21:23:39 +02:00
Disconnect3d
09cc1b670a
Fix off by one errors in asm_bf (#16570)
The `strncmp` calls with `"in"` and `"out"` string literals seems to have wrong size argument passed. This PR fixes it.
2020-04-13 19:53:22 +02:00
Khairul Azhar Kasmiran
c4a093d45e
x86_64: Use MOV opcode C7 for MOV r64, -<1 to 0x80000000> (#16551) ##asm 2020-04-12 22:47:12 +02:00
curly
f9d78db7e2
Tricore basic analysis plugin with reg profile (#16522) ##arch 2020-04-12 22:42:58 +02:00
Alexis Ehret
ef07476e38
Fix various lgtm warning (#16497)
* Wrong type of arguments to formatting function root/shlr/mpc/mpc.c
* Overflow in uncontrolled allocation size ./libr/socket/run.c
* Multiplication result converted to larger type ./libr/core/cmd_print.c
* Multiplication result converted to larger type ./libr/bin/p/bin_dyldcache.c
* Multiplication result converted to larger type ./libr/core/linux_heap_glibc.c
* Multiplication result converted to larger type ./libr/core/visual.c
* Comparison of narrow type with wide type in loop condition ./libr/core/p/core_java.c
* Fix various warning -Wall ./libr/core/p/core_java.c
* Multiplication result converted to larger type ./libr/bin/format/mach0/mach0.c
* Multiplication result converted to larger type ./libr/util/print.c
* Multiplication result converted to larger type ./libr/asm/asm.c
* Fix small warning python
* Fix type error and declaration inside loop
* Reset mpc
* replace size_t
* Fix space missing, type and format
2020-04-12 20:45:24 +02:00