1 /*
2 * Copyright © 2023 Igalia S.L.
3 * SPDX-License-Identifier: MIT
4 */
5
6 #include <stdio.h>
7
8 #include "util/os_file.h"
9
10 #include "etnaviv-isa.h"
11
12 static void
pre_instr_cb(void * d,unsigned n,void * instr)13 pre_instr_cb(void *d, unsigned n, void *instr)
14 {
15 uint32_t *dwords = (uint32_t *)instr;
16 printf("%03d [%08x %08x %08x %08x] ", n, dwords[0], dwords[1], dwords[2], dwords[3]);
17 }
18
19 int
main(int argc,char * argv[])20 main(int argc, char *argv[])
21 {
22 size_t sz;
23 void *raw = os_read_file(argv[1], &sz);
24
25 etnaviv_isa_disasm(raw, sz, stdout,
26 &(struct isa_decode_options){
27 .show_errors = true,
28 .branch_labels = true,
29 .pre_instr_cb = pre_instr_cb,
30 });
31
32 return 0;
33 }
34