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

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

Version: ~ [ linux-5.14-rc3 ] ~ [ linux-5.13.5 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.53 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.135 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.198 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.240 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.276 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.276 ] ~ [ 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 static struct ins x86__instructions[] = {
  3         { .name = "add",        .ops = &mov_ops,  },
  4         { .name = "addl",       .ops = &mov_ops,  },
  5         { .name = "addq",       .ops = &mov_ops,  },
  6         { .name = "addw",       .ops = &mov_ops,  },
  7         { .name = "and",        .ops = &mov_ops,  },
  8         { .name = "bts",        .ops = &mov_ops,  },
  9         { .name = "call",       .ops = &call_ops, },
 10         { .name = "callq",      .ops = &call_ops, },
 11         { .name = "cmp",        .ops = &mov_ops,  },
 12         { .name = "cmpb",       .ops = &mov_ops,  },
 13         { .name = "cmpl",       .ops = &mov_ops,  },
 14         { .name = "cmpq",       .ops = &mov_ops,  },
 15         { .name = "cmpw",       .ops = &mov_ops,  },
 16         { .name = "cmpxch",     .ops = &mov_ops,  },
 17         { .name = "dec",        .ops = &dec_ops,  },
 18         { .name = "decl",       .ops = &dec_ops,  },
 19         { .name = "imul",       .ops = &mov_ops,  },
 20         { .name = "inc",        .ops = &dec_ops,  },
 21         { .name = "incl",       .ops = &dec_ops,  },
 22         { .name = "ja",         .ops = &jump_ops, },
 23         { .name = "jae",        .ops = &jump_ops, },
 24         { .name = "jb",         .ops = &jump_ops, },
 25         { .name = "jbe",        .ops = &jump_ops, },
 26         { .name = "jc",         .ops = &jump_ops, },
 27         { .name = "jcxz",       .ops = &jump_ops, },
 28         { .name = "je",         .ops = &jump_ops, },
 29         { .name = "jecxz",      .ops = &jump_ops, },
 30         { .name = "jg",         .ops = &jump_ops, },
 31         { .name = "jge",        .ops = &jump_ops, },
 32         { .name = "jl",         .ops = &jump_ops, },
 33         { .name = "jle",        .ops = &jump_ops, },
 34         { .name = "jmp",        .ops = &jump_ops, },
 35         { .name = "jmpq",       .ops = &jump_ops, },
 36         { .name = "jna",        .ops = &jump_ops, },
 37         { .name = "jnae",       .ops = &jump_ops, },
 38         { .name = "jnb",        .ops = &jump_ops, },
 39         { .name = "jnbe",       .ops = &jump_ops, },
 40         { .name = "jnc",        .ops = &jump_ops, },
 41         { .name = "jne",        .ops = &jump_ops, },
 42         { .name = "jng",        .ops = &jump_ops, },
 43         { .name = "jnge",       .ops = &jump_ops, },
 44         { .name = "jnl",        .ops = &jump_ops, },
 45         { .name = "jnle",       .ops = &jump_ops, },
 46         { .name = "jno",        .ops = &jump_ops, },
 47         { .name = "jnp",        .ops = &jump_ops, },
 48         { .name = "jns",        .ops = &jump_ops, },
 49         { .name = "jnz",        .ops = &jump_ops, },
 50         { .name = "jo",         .ops = &jump_ops, },
 51         { .name = "jp",         .ops = &jump_ops, },
 52         { .name = "jpe",        .ops = &jump_ops, },
 53         { .name = "jpo",        .ops = &jump_ops, },
 54         { .name = "jrcxz",      .ops = &jump_ops, },
 55         { .name = "js",         .ops = &jump_ops, },
 56         { .name = "jz",         .ops = &jump_ops, },
 57         { .name = "lea",        .ops = &mov_ops,  },
 58         { .name = "lock",       .ops = &lock_ops, },
 59         { .name = "mov",        .ops = &mov_ops,  },
 60         { .name = "movb",       .ops = &mov_ops,  },
 61         { .name = "movdqa",     .ops = &mov_ops,  },
 62         { .name = "movl",       .ops = &mov_ops,  },
 63         { .name = "movq",       .ops = &mov_ops,  },
 64         { .name = "movslq",     .ops = &mov_ops,  },
 65         { .name = "movzbl",     .ops = &mov_ops,  },
 66         { .name = "movzwl",     .ops = &mov_ops,  },
 67         { .name = "nop",        .ops = &nop_ops,  },
 68         { .name = "nopl",       .ops = &nop_ops,  },
 69         { .name = "nopw",       .ops = &nop_ops,  },
 70         { .name = "or",         .ops = &mov_ops,  },
 71         { .name = "orl",        .ops = &mov_ops,  },
 72         { .name = "test",       .ops = &mov_ops,  },
 73         { .name = "testb",      .ops = &mov_ops,  },
 74         { .name = "testl",      .ops = &mov_ops,  },
 75         { .name = "xadd",       .ops = &mov_ops,  },
 76         { .name = "xbeginl",    .ops = &jump_ops, },
 77         { .name = "xbeginq",    .ops = &jump_ops, },
 78         { .name = "retq",       .ops = &ret_ops,  },
 79 };
 80 
 81 static bool x86__ins_is_fused(struct arch *arch, const char *ins1,
 82                               const char *ins2)
 83 {
 84         if (arch->family != 6 || arch->model < 0x1e || strstr(ins2, "jmp"))
 85                 return false;
 86 
 87         if (arch->model == 0x1e) {
 88                 /* Nehalem */
 89                 if ((strstr(ins1, "cmp") && !strstr(ins1, "xchg")) ||
 90                      strstr(ins1, "test")) {
 91                         return true;
 92                 }
 93         } else {
 94                 /* Newer platform */
 95                 if ((strstr(ins1, "cmp") && !strstr(ins1, "xchg")) ||
 96                      strstr(ins1, "test") ||
 97                      strstr(ins1, "add") ||
 98                      strstr(ins1, "sub") ||
 99                      strstr(ins1, "and") ||
100                      strstr(ins1, "inc") ||
101                      strstr(ins1, "dec")) {
102                         return true;
103                 }
104         }
105 
106         return false;
107 }
108 
109 static int x86__cpuid_parse(struct arch *arch, char *cpuid)
110 {
111         unsigned int family, model, stepping;
112         int ret;
113 
114         /*
115          * cpuid = "GenuineIntel,family,model,stepping"
116          */
117         ret = sscanf(cpuid, "%*[^,],%u,%u,%u", &family, &model, &stepping);
118         if (ret == 3) {
119                 arch->family = family;
120                 arch->model = model;
121                 return 0;
122         }
123 
124         return -1;
125 }
126 
127 static int x86__annotate_init(struct arch *arch, char *cpuid)
128 {
129         int err = 0;
130 
131         if (arch->initialized)
132                 return 0;
133 
134         if (cpuid)
135                 err = x86__cpuid_parse(arch, cpuid);
136 
137         arch->initialized = true;
138         return err;
139 }
140 

~ [ 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