2075 Commits

Author SHA1 Message Date
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
Khairul Azhar Kasmiran
9227c6790f
Fix #16433 - Support movabs for x86_64's MOV r64, imm64 (#16527) 2020-04-11 23:34:44 +08:00
pancake
067bf11e98
Fix #16109 - Add R_SYS_ARCH for s390x ##ports (#16471) 2020-04-10 08:09:41 +02:00
radare
3f77b9a76b
Avoid duplicated module filenames to fix static.sh ##build (#16403) 2020-04-02 14:30:27 +02:00
radare
bc38b17a62
Remove r_str_rmch and simplify r_str_replace_char* ##util (#16258) 2020-03-19 17:54:28 +01:00
Tigre000
4c684f1971
Fix arm64 branch assemble (#16205) ##asm 2020-03-19 00:21:48 +01:00
Florian Märkl
0b5e78e923
Make size arg of r_file_slurp() size_t (#16221) 2020-03-15 23:34:38 +01:00
Khairul Azhar Kasmiran
2c8d5982cd
Convert preinc/predec in 3rd part of for statement to postinc/postdec (#16187) 2020-03-12 18:40:46 +01:00
Rishi Bhatt
f2aaa72fa2
Support asm.cpu for Tricore architecture (#16161) ##asm 2020-03-10 14:10:57 +01:00
radare
72093ac706
Fix #16138 - Do not preincrement when it's not necessary (#16151) 2020-03-05 19:06:59 +01:00
radare
e37a2e1b9c
Fix UAF in om= (#16149) 2020-03-05 18:07:03 +01:00
Khairul Kasmiran
78e21373be Revert "ONE_STREAM_HACK & scr.onestream: Force expected ONE_STREAM order if necessary (#15535)"
This reverts commit 39b40cdedd48ac0745a0a5f2df379132ee1005ef.
2020-02-17 00:00:46 +01:00
Khairulmizam Samsudin
0de6f6481d Add asm x86 neg 2020-02-10 08:09:17 +01:00
Manuel Prinz
273133da7d
Determine Gameboy hardware registers in disassembly (#15909) ##asm
* Return address for unknown Gameboy hardware registers
2020-02-07 09:41:30 +01:00
Hye Sung Jung
757c23d5db Fix spelling errors (#15904) 2020-01-27 07:43:47 +01:00
Khairulmizam Samsudin
8f752d435e Arm64 assembler mov immediate word fix (#15884) ##asm 2020-01-23 11:41:44 -05:00
Khairulmizam Samsudin
d937bebf67 Add cbnz and cbz instruction for arm64 assembler (#15871)
* Add cbz and cbnz instructions
* Added cbnz and cbz test case
2020-01-21 14:59:41 -05:00
radare
551a0986d6
'push rip' is not a valid instruction ##asm (#15804) 2020-01-14 14:36:45 +01:00
Florian Märkl
de59bada55 Fix warnings in or1k_disas.c 2019-12-16 00:30:45 +01:00
GustavoLCR
07b5e062f2 Fix #15545 - Fix NULL derefs after r_file_slurp() fails 2019-12-15 23:38:38 +01:00
Paul I
9a4578a915 Replace some strstr() calls with strchr() 2019-12-15 23:37:27 +01:00
Anton Kochkov
e11b2a9145
Some Coverity defect fixes (#15626) 2019-12-13 11:25:19 -06:00
Francesco Tamagni
9fd379faff Rename or1k insns global (#15613)
As in certain build configurations it conflicts with the Capstone’s symbol of the same name, raising errors in the linking phase.
2019-12-11 18:56:14 +01:00
Khairul Azhar Kasmiran
a82297adc1 Fix signed integer overflow in r_asm_massemble (#15551) 2019-12-08 08:08:29 +01:00
Florian Märkl
021ad4d59b Fix an int Overflow in r_asm_massemble() for #15543 2019-12-06 19:32:29 +01:00
pancake
204b7317be Blindfix for #15543 - aka CVE-2019-19590 2019-12-05 17:43:57 +01:00
Khairul Azhar Kasmiran
39b40cdedd
ONE_STREAM_HACK & scr.onestream: Force expected ONE_STREAM order if necessary (#15535) 2019-12-02 23:09:38 +08:00
GustavoLCR
ebaf8b603e Fix some warnings on Windows (#15532) 2019-11-30 00:49:16 +01:00
Kamil Lorenc
e13281829c Add support for or1k (OpenRISC) disasm+analysis (#15515) ##arch 2019-11-29 11:35:16 +01:00
Florian Märkl
521ac7c28f Fix a Double Free in tms320/c55x+ (#15505) 2019-11-26 16:30:56 +01:00
MartinJM
6bc9e58311 Fix for #15459 - Also set the first operant to the right value on a mov from pointer with offset ##asm 2019-11-14 22:57:52 +01:00
F3real
032a1eb0c0 Fix x86 lahf instruction 2019-11-14 22:56:07 +01:00
condret
31d6b5764a Fill op->mnemonic in anal-gb 2019-11-03 07:23:27 +01:00
Riccardo Schirone
05df48a96c r_8051_disas should not be exported (#15347) 2019-10-24 13:14:05 +02:00
Florian Märkl
aad2a2c79e Link sdb fully into r_util in meson (#15338) ##build 2019-10-23 15:52:19 +02:00
pancake
76bc3b0282 Fix macOS build 2019-10-23 12:15:21 +02:00
hmht
3a0a477867 Update 8051 plugin (#15321) ##anal
* handle 8051 ANAL_OP DISASM

The 8051 assembler has been R_APId, #included in the local scope, and
called to fill op->mnemonic, which stops a bunch of warnings from
appearing whenever a bunch of disassembly appears on the screen.

The disassembler is called because of comments in r_anal.h: op->mnemonic
should contain the entire disassembly, not just the mnemonic.
Here's hoping the mnemonics and arguments will get split eventually.

* typdef some RAnal enums

In trying to make my analysis push out more info, it's difficult to
understand what all these ints mean, while ACTUALLY they should be
filled with enum values. By using the enum names, that's made clear
immediately.

r2's style is typedef over `enum name`, so that's what I did.

the typedef-instead-of-int I added here isn't consistently propagated,
and has caused warnings about unhandled cases-in-switch, at least some
of which should just get a default: case added, but I'd rather leave it
to the domain experts, or my future self when I become that domain
expert.

* refactor 8051 optype switch into table

it's pretty much static data with very meagre duplication, putting it in
a switch-case is unwieldy.

* add cycle info to 8051 opcode analysis

* add more basic 8051 anal info

op->cond, eob, nopcode, family, id

they seem mostly useless, but it's not much work to add, so...

* use ANAL_OP_MASK_VAL

* fixup! handle 8051 ANAL_OP DISASM

* fixup! use ANAL_OP_MASK_VAL

* Revert "use ANAL_OP_MASK_VAL"

:)

Clearly I was using MASK_VAL incorrectly, the only hint to its use was:

> // It fills RAnalop->dst/src info

so even though it's named "VAL", it might not actually need
to fill RAnalop->val...

Nor ptr, and definitely not jump and fail, which means we don't have use
for it yet! Not until I actually implement ->dst/src
2019-10-22 23:07:29 +02:00
Fritz Reese
f4b0ec9623 Fix #15302 [rasm2/armass] Correctly propagate errors from thumb_assemble (#15303) ##asm 2019-10-19 01:48:14 +02:00
hmht
48ca0e7ace Add additional [indirect] access syntax for 8051 (#15272) ##asm
8051 natively uses an '@' prefix for indirect access, which is
a bit awkward is r2, so it should also support the bracket syntax:

xrl a, @r0
xrl a, [r0]

Additionally, I refactored the argument tokenization so that it's all done
up-front, making everything easier to work with, saving about 800 LOC.
2019-10-14 12:45:26 +02:00
condret
77e73c16f7 add 8bit register dereferencing for 2 operand instructions in mcs96 disassembler 2019-10-13 20:28:17 +02:00