Is there any instruction decoder for the ARM v7-M Instruction Set, that I can just give it an opcode as parameter and return me with the corresponding instruction type?
For example: MOV Rd, <op2>
has four different versions depending on the <op2>
.
I want to know which of this version it is from the opcode of the instruction?
Editors note: opcode means the actual 'hex' instruction or machine encoding. The question is about the assembler mnemonic. On many CPUs a leading mnemonic may map to different opcodes (or machine instructions) depending on the arguments.
Yes, it's called a disassembler. Put the op code in an assembly file, build it, and then disassemble it.
$ cat in.s
.syntax unified
.align 2
.code 16
.globl _foo
.thumb_func _foo
_foo:
.short 0x4615
.long 0x43e0e92d
$ clang -arch armv7m -c in.s
$ otool -arch armv7m -tv in.o
in.o:
(__TEXT,__text) section
_foo:
00000000 4615 mov r5, r2
00000002 e92d43e0 push.w {r5, r6, r7, r8, r9, lr}