1205 Commits

Author SHA1 Message Date
Sven Steinbauer
995c952c5d Fix #5097 : mov instruction with rex regs
sil, dil, spl, and bpl, registers now supported
2016-06-22 13:04:23 +02:00
Sven Steinbauer
db76ef6497 Add bt instruction [fix #1277] (#5194) 2016-06-22 12:31:08 +02:00
Sylvain Pelissier
50aed82b66 Add lfence, mfence and sfence to x86.nz (#5193) 2016-06-22 10:29:26 +02:00
danielps
1b21628964 V810: Fix floating-point instructions (#5186) 2016-06-20 23:39:01 +02:00
pancake
f96f00d62d Fix #5158 - Merge r_db into r_util 2016-06-17 12:19:16 +02:00
Sven Steinbauer
d45101eebe Add offset support to add instruction (#5137)
support syntax for

add eax, [ecx]
add ecx, [eba +/- 3]
2016-06-15 15:33:14 +02:00
pancake
e032a48cbe Fix latest 26 COVs 2016-06-14 23:47:58 +02:00
pancake
8a82e5cae6 Implement 'cbz' in armass-thumb 2016-06-13 11:12:20 +02:00
Sven Steinbauer
deebcc5f46 Add check for 64bit overflow (#5116) 2016-06-10 17:02:51 +02:00
Jeffrey Crowell
3e8a0cc693 replace usage of killed r_str_trim 2016-06-10 01:12:07 +00:00
Sven Steinbauer
00e964e9b6 Add support to mov for negative immediates (#5090)
mov eax, -3
2016-06-07 12:23:44 +02:00
Sven Steinbauer
6e4a1b55b1 Error if moving 64bit val to 32bit reg (#5088)
mov eax, 0x1122334455667788 now errors if trying to assemble with -b64.
2016-06-07 11:01:35 +02:00
pancake
eb9feef231 Fixes for powerpc endian in mach0 and other issues 2016-06-06 22:57:22 +02:00
pancake
608b79d2b4 Finally fix the build on osx-ppc 2016-06-06 17:30:07 +02:00
pancake
5903bc0d10 Fix #5083 - null deref in armass 2016-06-06 16:53:56 +02:00
pancake
d3394d5a7a Fix latest 28 COVs 2016-06-02 03:19:31 +02:00
pancake
03294af32b Fix null deref in libr_asm and add lang-python r2pm pkg 2016-06-02 02:45:38 +02:00
pancake
95b2e511f5 Fix some warnings 2016-06-01 12:23:10 +02:00
Sven Steinbauer
63dd8590d7 Refactor mov assembly for nz (#5057)
* reg offset code consolidated to single location and simplified
* Refactor `getreg` for `arg` and `arg2` to use `r0` and `r1` throughout
        `mov` case

Should clean it up a little.
2016-06-01 12:15:33 +02:00
Karol Harasim
d190e0d3c3 Add description for Xtensa instructions 2016-05-31 21:48:18 +02:00
pancake
c64eeaa266 Initial implementation of asm.assembler to select different assembler plugin than the disasm 2016-05-30 18:53:32 +02:00
Duncan Ogilvie
216de66e68 fixed jcc (#5034) 2016-05-30 04:21:02 +02:00
Duncan Ogilvie
021a3ea8b2 Update x86 (#5035) 2016-05-30 04:20:29 +02:00
Duncan Ogilvie
18ffea18cc added/fixed various cmovXX opcodes (#5033)
As per the Intel manual:

```
CMOVcc - Conditional Move:
| Opcode          | Instruction       | Op/En| 64-Bit Mode| Compat/Leg Mode| Description                            
| 0F 47 /r        | CMOVA r16, r/m16  | RM   | Valid      | Valid          | Move if above (CF=0 and ZF=0).         
| REX.W + 0F 43 /r| CMOVAE r64, r/m64 | RM   | Valid      | N.E.           | Move if above or equal (CF=0).         
| 0F 42 /r        | CMOVB r16, r/m16  | RM   | Valid      | Valid          | Move if below (CF=1).                  
| REX.W + 0F 46 /r| CMOVBE r64, r/m64 | RM   | Valid      | N.E.           | Move if below or equal (CF=1 or ZF=1). 
| 0F 42 /r        | CMOVC r16, r/m16  | RM   | Valid      | Valid          | Move if carry (CF=1).                  
| REX.W + 0F 44 /r| CMOVE r64, r/m64  | RM   | Valid      | N.E.           | Move if equal (ZF=1).                  
| 0F 4F /r        | CMOVG r16, r/m16  | RM   | Valid      | Valid          | Move if greater (ZF=0 and SF=OF).      
| REX.W + 0F 4D /r| CMOVGE r64, r/m64 | RM   | Valid      | N.E.           | Move if greater or equal (SF=OF).      
| 0F 4C /r        | CMOVL r16, r/m16  | RM   | Valid      | Valid          | Move if less (SF!= OF).                 
| REX.W + 0F 4E /r| CMOVLE r64, r/m64 | RM   | Valid      | N.E.           | Move if less or equal (ZF=1 or SF!= OF).
| 0F 46 /r        | CMOVNA r16, r/m16 | RM   | Valid      | Valid          | Move if not above (CF=1 or ZF=1).      
| REX.W + 0F 42 /r| CMOVNAE r64, r/m64| RM   | Valid      | N.E.           | Move if not above or equal (CF=1).     
| 0F 43 /r        | CMOVNB r16, r/m16 | RM   | Valid      | Valid          | Move if not below (CF=0).              
| REX.W + 0F 47 /r| CMOVNBE r64, r/m64| RM   | Valid      | N.E.           | Move if not below or equal (CF=0 and   
|                 |                   |      |            |                | ZF=0).                                 
| 0F 43 /r        | CMOVNC r16, r/m16 | RM   | Valid      | Valid          | Move if not carry (CF=0).              
| REX.W + 0F 45 /r| CMOVNE r64, r/m64 | RM   | Valid      | N.E.           | Move if not equal (ZF=0).              
| 0F 4E /r        | CMOVNG r16, r/m16 | RM   | Valid      | Valid          | Move if not greater (ZF=1 or SF!= OF).  
| REX.W + 0F 4C /r| CMOVNGE r64, r/m64| RM   | Valid      | N.E.           | Move if not greater or equal (SF!= OF). 
| 0F 4D /r        | CMOVNL r16, r/m16 | RM   | Valid      | Valid          | Move if not less (SF=OF).              
| REX.W + 0F 4F /r| CMOVNLE r64, r/m64| RM   | Valid      | N.E.           | Move if not less or equal (ZF=0 and    
|                 |                   |      |            |                | SF=OF).                                
| 0F 41 /r        | CMOVNO r16, r/m16 | RM   | Valid      | Valid          | Move if not overflow (OF=0).           
| REX.W + 0F 4B /r| CMOVNP r64, r/m64 | RM   | Valid      | N.E.           | Move if not parity (PF=0).             
| 0F 49 /r        | CMOVNS r16, r/m16 | RM   | Valid      | Valid          | Move if not sign (SF=0).               
| REX.W + 0F 45 /r| CMOVNZ r64, r/m64 | RM   | Valid      | N.E.           | Move if not zero (ZF=0).               
| 0F 40 /r        | CMOVO r16, r/m16  | RM   | Valid      | Valid          | Move if overflow (OF=1).               
| REX.W + 0F 4A /r| CMOVP r64, r/m64  | RM   | Valid      | N.E.           | Move if parity (PF=1).                 
| 0F 4A /r        | CMOVPE r16, r/m16 | RM   | Valid      | Valid          | Move if parity even (PF=1).            
| REX.W + 0F 4B /r| CMOVPO r64, r/m64 | RM   | Valid      | N.E.           | Move if parity odd (PF=0).             
| 0F 48 /r        | CMOVS r16, r/m16  | RM   | Valid      | Valid          | Move if sign (SF=1).                   
| REX.W + 0F 44 /r| CMOVZ r64, r/m64  | RM   | Valid      | N.E.           | Move if zero (ZF=1).
```

* fixed typo

* or -> nor
2016-05-30 04:20:19 +02:00
Sven Steinbauer
c58689bae1 Fixes for mov op for nz assembler (#5020)
A number of fixes and updates to the `mov` command for the nz assembler
including:

* handling of `esp` register in more cases
* able to handle negative offsets for target register both byte and word
* able to handle negative offsets for target with immediate value as
        source, both byte and word
* refactor mov block of code to be more consistent (further work needed)
2016-05-27 18:11:01 +02:00
Sven Steinbauer
76a4e0ca7a Add support for immediate word for sub (#5006)
`nz` now generates the correct opcode when using a word as an immediate
in the `sub` instruction with a register + offset as the target

Also adds support for word register offsets and refactors that portion
of the code a little

For 32bit only so far
2016-05-25 17:22:00 +02:00
jvoisin
4b8af71ef4 Removed a duplicate loopne and loopnz entry
removed a duplicate `loopne` and `loopnz` entry
2016-05-25 15:24:13 +02:00
Jeffrey Crowell
2a77791616 add 64bit xchg instruction
still broken for the special case of xchg (E|R)ax, r(32|64)

but will add that next
2016-05-24 15:13:37 +00:00
Roman Valls Guimerà
6f66ba9b84 Typo "intro"->"into memory" (#4991) 2016-05-24 16:07:38 +02:00
Anton Kochkov
f6b18bcb56 Fix CID 1356018 2016-05-24 08:54:39 +03:00
Sven Steinbauer
8da8ad740f Cleanup fixes
* For commit comments and compiler errors
* Fixes for PR comments
* fix some "infer fixes" commits

Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
2016-05-23 11:25:44 +02:00
Sven Steinbauer
599b6553e4 Infer fixes for asm
Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
2016-05-23 11:25:44 +02:00
pancake
7f6029f17c Fix OR x86.nz test 2016-05-18 11:17:26 +02:00
pancake
2fd754a76c Fix #4938 - Implement 'or REG, NUM' in the x86.nz assembler 2016-05-18 10:48:48 +02:00
Riccardo Schirone
5b92204c27 asm/arch/avr: do not print space if there are no operands 2016-05-17 13:18:23 +02:00
pancake
22989f1ce9 Workaround for x86.nz inc [eax] 2016-05-14 10:59:54 +02:00
Sven Steinbauer
074b327c1c Fix #3644 : Add SIB addressing support to nz compiler 2016-05-13 11:45:54 +02:00
pancake
b4bb247791 Add nop for arm64 assembler 2016-05-10 11:22:13 +02:00
Sven Steinbauer
766b9ec4f0 Add support for dword offsets (#4825)
* Add support for dword offsets to internal assembler

Internal assembler produces incorrect opcodes for offsets that were
greater than a short.

    rasm2 "mov eax, [eax + 1337]"
    8b8039

This adds support for values >127.

    rasm2 "mov eax, [eax + 1337]"
    8b8039050000

producing the same output as the `nasm` assembler.

* Fix support for negative short and dword offsets

Handle negative offsets for `mov` instructions both short and dword
sizes.

* Whitespace fixes

* Remove rogue character

Remove the reogue `:` that got into the code
2016-05-09 15:25:20 +02:00
Damien Zammit
5e1ad580db build: fix warnings 2016-05-08 12:21:11 +02:00
Sven Steinbauer
7c0b3eb64a Fix #4745 incorrect assembly for x86 mov (#4791) 2016-05-06 16:08:41 +02:00
Damien Zammit
632dccc217 Remove LIL_ENDIAN macro and configure option
TODO: Remove other endian cruft from:
- hashing algs
- judy
- squashfs
- grub
- tms320

Signed-off-by: Damien Zammit <damien@zamaudio.com>
2016-05-06 10:21:55 +02:00
Damien Zammit
af0a865d9f WIP - Totally remove host endianness dependence
- Adds endian aware functions
- Removes references to host endian
- Uses binary detected endianness else tries LE and restricts by RAsmPlugin
- Fixes gdb debugger endianness when debugging BE qemu gdbserver

Signed-off-by: Damien Zammit <damien@zamaudio.com>
2016-05-04 23:42:17 +10:00
Álvaro Felipe Melchor
149c7567ed improve arm/thumb detection for .so 2016-05-02 23:00:53 +02:00
pancake
1f7db90e41 Priorize keystone plugins and other random changes 2016-05-02 02:46:01 +02:00
pancake
b417da6d4d Add setarch/(from|to).string simplified RAsm APIs 2016-04-29 11:30:38 +02:00
Riccardo Schirone
26fc8f92ef libr: remove some unused variables and functions 2016-04-27 12:59:45 +02:00
pancake
bfc8e5318e More fixes from osx-ppc 2016-04-27 11:27:22 +02:00
pancake
e9dc4ae89e Fix #4695 - no prompt after r2 -qp 2016-04-26 19:11:11 +02:00
kolen
a65ea77725 Fix 'ed' opcode range resulted in overflow
Should be:
40 41 .. 4a 4b
   maps to
00 01 .. 0a 0b

Was:
3a 3b 3c 3d 3e 3f 40 41 .. 4a 4b
            maps to
fa fb fc fd fe ff 00 01 .. 0a 0b
2016-04-21 15:33:26 +02:00