1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/compiler.h>
6 struct arm64_annotate
{
11 static struct ins_ops
*arm64__associate_instruction_ops(struct arch
*arch
, const char *name
)
13 struct arm64_annotate
*arm
= arch
->priv
;
17 if (!regexec(&arm
->jump_insn
, name
, 2, match
, 0))
19 else if (!regexec(&arm
->call_insn
, name
, 2, match
, 0))
21 else if (!strcmp(name
, "ret"))
26 arch__associate_ins_ops(arch
, name
, ops
);
30 static int arm64__annotate_init(struct arch
*arch
, char *cpuid __maybe_unused
)
32 struct arm64_annotate
*arm
;
35 if (arch
->initialized
)
38 arm
= zalloc(sizeof(*arm
));
43 err
= regcomp(&arm
->call_insn
, "^blr?$", REG_EXTENDED
);
46 /* b, b.cond, br, cbz/cbnz, tbz/tbnz */
47 err
= regcomp(&arm
->jump_insn
, "^[ct]?br?\\.?(cc|cs|eq|ge|gt|hi|le|ls|lt|mi|ne|pl)?n?z?$",
52 arch
->initialized
= true;
54 arch
->associate_instruction_ops
= arm64__associate_instruction_ops
;
55 arch
->objdump
.comment_char
= '/';
56 arch
->objdump
.skip_functions_char
= '+';
60 regfree(&arm
->call_insn
);