diff options
| author | Rusty Wagner <rusty.wagner@gmail.com> | 2024-03-05 19:50:13 -0500 |
|---|---|---|
| committer | Rusty Wagner <rusty.wagner@gmail.com> | 2024-03-05 20:34:34 -0500 |
| commit | e093c21ed880ac3eb72119be15093ee04f8ce299 (patch) | |
| tree | 9f720ebdc0ae415734b1199ed341668c69710a94 /arch/armv7/armv7_disasm/test.c | |
| parent | 0609276712622908254065546102381466033141 (diff) | |
Move architecture modules into the API repo
Diffstat (limited to 'arch/armv7/armv7_disasm/test.c')
| -rw-r--r-- | arch/armv7/armv7_disasm/test.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/arch/armv7/armv7_disasm/test.c b/arch/armv7/armv7_disasm/test.c new file mode 100644 index 00000000..162cb5ac --- /dev/null +++ b/arch/armv7/armv7_disasm/test.c @@ -0,0 +1,38 @@ +// gcc -g test.c armv7.c -o test +// lldb ./test -- e28f007b +// b armv7_decompose +// b armv7_disassemble +// + +#include <stdio.h> +#include <stdio.h> +#include <stdint.h> +#include "armv7.h" + +int main(int ac, char **av) +{ + uint32_t insword = strtoul(av[1], NULL, 16); + uint32_t address = 0; + uint32_t endian = 0; + uint32_t rc; + + Instruction instr; + memset(&instr, 0, sizeof(instr)); + + rc = armv7_decompose(insword, &instr, address, endian); + if(rc) { + printf("ERROR: armv7_decompose() returned %d\n", rc); + return rc; + } + + char instxt[4096]; + memset(instxt, 0, sizeof(instxt)); + rc = armv7_disassemble(&instr, instxt, sizeof(instxt)); + if(rc) { + printf("ERROR: armv7_disassemble() returned %d\n", rc); + return rc; + } + + printf("%08X: %s\n", address, instxt); +} + |
