Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 
0003 static
0004 struct ins_ops *mips__associate_ins_ops(struct arch *arch, const char *name)
0005 {
0006     struct ins_ops *ops = NULL;
0007 
0008     if (!strncmp(name, "bal", 3) ||
0009         !strncmp(name, "bgezal", 6) ||
0010         !strncmp(name, "bltzal", 6) ||
0011         !strncmp(name, "bgtzal", 6) ||
0012         !strncmp(name, "blezal", 6) ||
0013         !strncmp(name, "beqzal", 6) ||
0014         !strncmp(name, "bnezal", 6) ||
0015         !strncmp(name, "bgtzl", 5) ||
0016         !strncmp(name, "bltzl", 5) ||
0017         !strncmp(name, "bgezl", 5) ||
0018         !strncmp(name, "blezl", 5) ||
0019         !strncmp(name, "jialc", 5) ||
0020         !strncmp(name, "beql", 4) ||
0021         !strncmp(name, "bnel", 4) ||
0022         !strncmp(name, "jal", 3))
0023         ops = &call_ops;
0024     else if (!strncmp(name, "jr", 2))
0025         ops = &ret_ops;
0026     else if (name[0] == 'j' || name[0] == 'b')
0027         ops = &jump_ops;
0028     else
0029         return NULL;
0030 
0031     arch__associate_ins_ops(arch, name, ops);
0032 
0033     return ops;
0034 }
0035 
0036 static
0037 int mips__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
0038 {
0039     if (!arch->initialized) {
0040         arch->associate_instruction_ops = mips__associate_ins_ops;
0041         arch->initialized = true;
0042         arch->objdump.comment_char = '#';
0043     }
0044 
0045     return 0;
0046 }