RASM2 can't re-assemble its own disassembly output for ARM?

150 Views Asked by At

In case I run the code below on Linux:

rasm2 -a arm -b 16 -d "28 46 0d f2 74 4d f0 bd"

Result is:

mov r0, r5
addw sp, sp, 0x474
pop {r4, r5, r6, r7, pc}

But now the question is, if I try to re-assemble the disassembly back into hexadecimal machine code again, it doesn't work:

rasm2 -a arm -b 16 "mov r0, r5;addw sp, sp, 0x474;pop {r4, r5, r6, r7, pc};"
Cannot assemble 'addw sp, sp, 0x474' at line 8
invalid

This is what happened.

So how can I assemble my assembly code to a hexadecimal in an accurate way, using rasm2 or else, and what is the reason of that error?

0

There are 0 best solutions below