~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/arch/arm64/annotate/instructions.c

Version: ~ [ linux-5.15-rc1 ] ~ [ linux-5.14.5 ] ~ [ linux-5.13.18 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.66 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.147 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.206 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.246 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.282 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.283 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 #include <linux/compiler.h>
  3 #include <sys/types.h>
  4 #include <regex.h>
  5 
  6 struct arm64_annotate {
  7         regex_t call_insn,
  8                 jump_insn;
  9 };
 10 
 11 static struct ins_ops *arm64__associate_instruction_ops(struct arch *arch, const char *name)
 12 {
 13         struct arm64_annotate *arm = arch->priv;
 14         struct ins_ops *ops;
 15         regmatch_t match[2];
 16 
 17         if (!regexec(&arm->jump_insn, name, 2, match, 0))
 18                 ops = &jump_ops;
 19         else if (!regexec(&arm->call_insn, name, 2, match, 0))
 20                 ops = &call_ops;
 21         else if (!strcmp(name, "ret"))
 22                 ops = &ret_ops;
 23         else
 24                 return NULL;
 25 
 26         arch__associate_ins_ops(arch, name, ops);
 27         return ops;
 28 }
 29 
 30 static int arm64__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
 31 {
 32         struct arm64_annotate *arm;
 33         int err;
 34 
 35         if (arch->initialized)
 36                 return 0;
 37 
 38         arm = zalloc(sizeof(*arm));
 39         if (!arm)
 40                 return -1;
 41 
 42         /* bl, blr */
 43         err = regcomp(&arm->call_insn, "^blr?$", REG_EXTENDED);
 44         if (err)
 45                 goto out_free_arm;
 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?$",
 48                       REG_EXTENDED);
 49         if (err)
 50                 goto out_free_call;
 51 
 52         arch->initialized = true;
 53         arch->priv        = arm;
 54         arch->associate_instruction_ops   = arm64__associate_instruction_ops;
 55         arch->objdump.comment_char        = '/';
 56         arch->objdump.skip_functions_char = '+';
 57         return 0;
 58 
 59 out_free_call:
 60         regfree(&arm->call_insn);
 61 out_free_arm:
 62         free(arm);
 63         return -1;
 64 }
 65 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp