1 // SPDX-License-Identifier: GPL-2.0
2
3 static
riscv64__associate_ins_ops(struct arch * arch,const char * name)4 struct ins_ops *riscv64__associate_ins_ops(struct arch *arch, const char *name)
5 {
6 struct ins_ops *ops = NULL;
7
8 if (!strncmp(name, "jal", 3) ||
9 !strncmp(name, "jr", 2) ||
10 !strncmp(name, "call", 4))
11 ops = &call_ops;
12 else if (!strncmp(name, "ret", 3))
13 ops = &ret_ops;
14 else if (name[0] == 'j' || name[0] == 'b')
15 ops = &jump_ops;
16 else
17 return NULL;
18
19 arch__associate_ins_ops(arch, name, ops);
20
21 return ops;
22 }
23
24 static
riscv64__annotate_init(struct arch * arch,char * cpuid __maybe_unused)25 int riscv64__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
26 {
27 if (!arch->initialized) {
28 arch->associate_instruction_ops = riscv64__associate_ins_ops;
29 arch->initialized = true;
30 arch->objdump.comment_char = '#';
31 }
32
33 return 0;
34 }
35