1 // SPDX-License-Identifier: GPL-2.0
5 struct arm64_annotate {
10 static struct ins_ops *arm64__associate_instruction_ops(struct arch *arch, const char *name)
12 struct arm64_annotate *arm = arch->priv;
16 if (!regexec(&arm->jump_insn, name, 2, match, 0))
18 else if (!regexec(&arm->call_insn, name, 2, match, 0))
20 else if (!strcmp(name, "ret"))
25 arch__associate_ins_ops(arch, name, ops);
29 static int arm64__annotate_init(struct arch *arch)
31 struct arm64_annotate *arm;
34 if (arch->initialized)
37 arm = zalloc(sizeof(*arm));
42 err = regcomp(&arm->call_insn, "^blr?$", REG_EXTENDED);
45 /* b, b.cond, br, cbz/cbnz, tbz/tbnz */
46 err = regcomp(&arm->jump_insn, "^[ct]?br?\\.?(cc|cs|eq|ge|gt|hi|le|ls|lt|mi|ne|pl)?n?z?$",
51 arch->initialized = true;
53 arch->associate_instruction_ops = arm64__associate_instruction_ops;
54 arch->objdump.comment_char = '/';
55 arch->objdump.skip_functions_char = '+';
59 regfree(&arm->call_insn);