Skip to content

Commit

Permalink
removed code which deletes indicator characters for certain asm synta…
Browse files Browse the repository at this point in the history
…xes, indicator characters should always show up
  • Loading branch information
moste00 committed May 29, 2024
1 parent 7b91fb6 commit a2e20e8
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 55 deletions.
8 changes: 1 addition & 7 deletions librz/arch/p/asm/asm_msp430.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ static int disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len) {
} else {
rz_asm_op_set_asm(op, cmd.instr);
}
char *buf_asm = rz_strbuf_get(&op->buf_asm);
if (a->syntax != RZ_ASM_SYNTAX_ATT) {
rz_str_replace_ch(buf_asm, '#', 0, 1);
// rz_str_replace_ch (buf_asm, "$", "$$", 1);
rz_str_replace_ch(buf_asm, '&', 0, 1);
rz_str_replace_ch(buf_asm, '%', 0, 1);
}

fail:
return op->size = ret;
}
Expand Down
46 changes: 23 additions & 23 deletions test/db/analysis/msp430
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@ echo
afi
EOF
EXPECT=<<EOF
add 0xff9c, sp
mov loc..strings, r15
call loc.puts
add #0xff9c, sp
mov #loc..strings, r15
call #loc.puts
mov sp, r15
call loc.get_password
call #loc.get_password
mov sp, r15
call loc.check_password
call #loc.check_password
tst r15
jnz $+0x000c
mov 0x44c7, r15
call loc.puts
mov #0x44c7, r15
call #loc.puts
jmp $+0x000e
mov 0x44e4, r15
call loc.puts
call loc.unlock_door
call #loc.puts
call #loc.unlock_door
clr r15
add 0x0064, sp
bis 0x00f0, sr
add #0x0064, sp
bis #0x00f0, sr
jmp $-0x0004

offset: 0x00004438
Expand Down Expand Up @@ -65,24 +65,24 @@ echo
afi
EOF
EXPECT=<<EOF
add 0xff9c, sp
mov loc..strings, r15
call loc.puts
add #0xff9c, sp
mov #loc..strings, r15
call #loc.puts
mov sp, r15
call loc.get_password
call #loc.get_password
mov sp, r15
call loc.check_password
call #loc.check_password
tst r15
jnz $+0x000c
mov str.Invalid_password_try_again, r15
call loc.puts
mov #str.Invalid_password_try_again, r15
call #loc.puts
jmp $+0x000e
mov str.Access_Granted, r15
call loc.puts
call loc.unlock_door
mov #str.Access_Granted, r15
call #loc.puts
call #loc.unlock_door
clr r15
add 0x0064, sp
bis 0x00f0, sr
add #0x0064, sp
bis #0x00f0, sr
jmp $-0x0004

offset: 0x00004438
Expand Down
50 changes: 25 additions & 25 deletions test/db/asm/msp430
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
d "adc r11" 0b63
d "adc.b r11" 4b63
d "bic 2, r10" 2ac3
d "bic 4, r10" 2ac2
d "bic.b 2, 0x0026" e2c32600
d "bic.b 4, 0x002e" e2c22e00
d "bis.b 2, 0x0021" e2d32100
d "br 0x0021" 30402100
d "br 0x0003" 10420300
d "bic #2, r10" 2ac3
d "bic #4, r10" 2ac2
d "bic.b #2, &0x0026" e2c32600
d "bic.b #4, &0x002e" e2c22e00
d "bis.b #2, &0x0021" e2d32100
d "br #0x0021" 30402100
d "br &0x0003" 10420300
d "br sp" 0041
d "br r10" 004a
d "call 0xc096" b01296c0
d "call #0xc096" b01296c0
d "clr 0x0033" 80433300
d "clr 0xfffa(r4)" 8443faff
d "clrn" 22c2
d "clrz" 22c3
d "cmp.b 0x003b, 0x0(r11)" fb903b000000
d "cmp.b #0x003b, 0x0(r11)" fb903b000000
d "dadc r11" 0ba3
d "dadc.b r11" 4ba3
d "dec r11" 1b83
Expand All @@ -25,30 +25,30 @@ d "inv 0x3(r5)" b5e30300
d "inv r10" 3ae3
d "jeq $+0x0014" 0924
d "jmp $+0x0010" 073c
d "mov 0x0003, 0x5(r9)" b94003000500
d "mov 0x000a, 0x002a" b0400a002a00
d "mov 0x0021, 0x6(r11)" bb4021000600
d "mov 1, 0x002c" 90432c00
d "mov 8, 0x002c" b0422c00
d "mov 8, 0x002e" b0422e00
d "mov 0x0033, 0x002e" 924233002e00
d "mov 0x0033, 0x002a" 904233002a00
d "mov 0x3(r6), 0x002e" 924603002e00
d "mov #0x0003, 0x5(r9)" b94003000500
d "mov #0x000a, 0x002a" b0400a002a00
d "mov #0x0021, 0x6(r11)" bb4021000600
d "mov #1, 0x002c" 90432c00
d "mov #8, 0x002c" b0422c00
d "mov #8, 0x002e" b0422e00
d "mov &0x0033, &0x002e" 924233002e00
d "mov &0x0033, 0x002a" 904233002a00
d "mov 0x3(r6), &0x002e" 924603002e00
d "mov 0x5(r10), 0x6(r11)" 9b4a05000600
d "mov 0x6(r11), 0x0033" 924b06003300
d "mov.b 0x0021, r15" 5f422100
d "mov.b r15, 0x0021" c24f2100
d "mov 0x6(r11), &0x0033" 924b06003300
d "mov.b &0x0021, r15" 5f422100
d "mov.b r15, &0x0021" c24f2100
d "nop" 0343
d "pop r11" 3b41
d "pop r4" 3441
d "push 1" 1312
d "push #1" 1312
d "ret" 3041
d "sbc r11" 0b73
d "sbc.b r11" 4b73
d "setc" 12d3
d "setz" 22d3
d "tst 0x0003" 82930300
d "tst &0x0003" 82930300
d "tst 0x3(r5)" 85930300
d "tst r10" 0a93
d "xor.b 0x0020, r15" 7fe02000
d "xor.b 8, r15" 7fe2
d "xor.b #0x0020, r15" 7fe02000
d "xor.b #8, r15" 7fe2

0 comments on commit a2e20e8

Please sign in to comment.