X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=opcodes%2Frx-dis.c;h=74ae870a5ec55ccebea1752ee5a92771b346ab15;hb=29d210012ab9928bf5ae9243e27f7500085984a8;hp=18bc170200d3e34063a6b2c6f246cf4f59ca86dd;hpb=12234dfd5f70086fde87e1f6d56cf2aa2ce5ec4c;p=binutils-gdb.git diff --git a/opcodes/rx-dis.c b/opcodes/rx-dis.c index 18bc170200d..74ae870a5ec 100644 --- a/opcodes/rx-dis.c +++ b/opcodes/rx-dis.c @@ -1,5 +1,5 @@ /* Disassembler code for Renesas RX. - Copyright (C) 2008-2019 Free Software Foundation, Inc. + Copyright (C) 2008-2022 Free Software Foundation, Inc. Contributed by Red Hat. Written by DJ Delorie. @@ -85,7 +85,7 @@ static char const * register_names[] = "psw", "pc", "usp", "fpsw", NULL, NULL, NULL, NULL, "bpsw", "bpc", "isp", "fintv", "intb", "extb", NULL, NULL, "a0", "a1", NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; static char const * condition_names[] = @@ -99,36 +99,36 @@ static const char * flag_names[] = { "c", "z", "s", "o", "", "", "", "", "", "", "", "", "", "", "", "", - "i", "u", "", "", "", "", "", "" - "", "", "", "", "", "", "", "", + "i", "u", "", "", "", "", "", "", + "", "", "", "", "", "", "", "" }; static const char * double_register_names[] = { "dr0", "dr1", "dr2", "dr3", "dr4", "dr5", "dr6", "dr7", - "dr8", "dr9", "dr10", "dr11", "dr12", "dr13", "dr14", "dr15", + "dr8", "dr9", "dr10", "dr11", "dr12", "dr13", "dr14", "dr15" }; static const char * double_register_high_names[] = { "drh0", "drh1", "drh2", "drh3", "drh4", "drh5", "drh6", "drh7", - "drh8", "drh9", "drh10", "drh11", "drh12", "drh13", "drh14", "drh15", + "drh8", "drh9", "drh10", "drh11", "drh12", "drh13", "drh14", "drh15" }; static const char * double_register_low_names[] = { "drl0", "drl1", "drl2", "drl3", "drl4", "drl5", "drl6", "drl7", - "drl8", "drl9", "drl10", "drl11", "drl12", "drl13", "drl14", "drl15", + "drl8", "drl9", "drl10", "drl11", "drl12", "drl13", "drl14", "drl15" }; static const char * double_control_register_names[] = { - "dpsw", "dcmr", "decnt", "depc", + "dpsw", "dcmr", "decnt", "depc" }; static const char * double_condition_names[] = { - "", "un", "eq", "", "lt", "", "le", + "", "un", "eq", "", "lt", "", "le" }; static inline const char * @@ -136,7 +136,7 @@ get_register_name (unsigned int reg) { if (reg < ARRAY_SIZE (register_names)) return register_names[reg]; - return _(""); + return _(""); } static inline const char * @@ -144,7 +144,7 @@ get_condition_name (unsigned int cond) { if (cond < ARRAY_SIZE (condition_names)) return condition_names[cond]; - return _(""); + return _(""); } static inline const char * @@ -152,7 +152,7 @@ get_flag_name (unsigned int flag) { if (flag < ARRAY_SIZE (flag_names)) return flag_names[flag]; - return _(""); + return _(""); } static inline const char * @@ -160,7 +160,7 @@ get_double_register_name (unsigned int reg) { if (reg < ARRAY_SIZE (double_register_names)) return double_register_names[reg]; - return _(""); + return _(""); } static inline const char * @@ -168,7 +168,7 @@ get_double_register_high_name (unsigned int reg) { if (reg < ARRAY_SIZE (double_register_high_names)) return double_register_high_names[reg]; - return _(""); + return _(""); } static inline const char * @@ -176,7 +176,7 @@ get_double_register_low_name (unsigned int reg) { if (reg < ARRAY_SIZE (double_register_low_names)) return double_register_low_names[reg]; - return _(""); + return _(""); } static inline const char * @@ -184,7 +184,7 @@ get_double_control_register_name (unsigned int reg) { if (reg < ARRAY_SIZE (double_control_register_names)) return double_control_register_names[reg]; - return _(""); + return _(""); } static inline const char * @@ -192,7 +192,23 @@ get_double_condition_name (unsigned int cond) { if (cond < ARRAY_SIZE (double_condition_names)) return double_condition_names[cond]; - return _(""); + return _(""); +} + +static inline const char * +get_opsize_name (unsigned int opsize) +{ + if (opsize < ARRAY_SIZE (opsize_names)) + return opsize_names[opsize]; + return _(""); +} + +static inline const char * +get_size_name (unsigned int size) +{ + if (size < ARRAY_SIZE (size_names)) + return size_names[size]; + return _(""); } @@ -278,34 +294,36 @@ print_insn_rx (bfd_vma addr, disassemble_info * dis) break; case 's': - PR (PS, "%s", opsize_names[opcode.size]); + PR (PS, "%s", get_opsize_name (opcode.size)); break; case 'b': s ++; - if (*s == 'f') { - int imm = opcode.op[2].addend; - int slsb, dlsb, width; - dlsb = (imm >> 5) & 0x1f; - slsb = (imm & 0x1f); - slsb = (slsb >= 0x10?(slsb ^ 0x1f) + 1:slsb); - slsb = dlsb - slsb; - slsb = (slsb < 0?-slsb:slsb); - width = ((imm >> 10) & 0x1f) - dlsb; - PR (PS, "#%d, #%d, #%d, %s, %s", - slsb, dlsb, width, - register_names[opcode.op[1].reg], - register_names[opcode.op[0].reg]); - } + if (*s == 'f') + { + int imm = opcode.op[2].addend; + int slsb, dlsb, width; + + dlsb = (imm >> 5) & 0x1f; + slsb = (imm & 0x1f); + slsb = (slsb >= 0x10?(slsb ^ 0x1f) + 1:slsb); + slsb = dlsb - slsb; + slsb = (slsb < 0?-slsb:slsb); + width = ((imm >> 10) & 0x1f) - dlsb; + PR (PS, "#%d, #%d, #%d, %s, %s", + slsb, dlsb, width, + get_register_name (opcode.op[1].reg), + get_register_name (opcode.op[0].reg)); + } break; case '0': case '1': case '2': - oper = opcode.op + *s - '0'; + oper = opcode.op + (*s - '0'); if (do_size) { if (oper->type == RX_Operand_Indirect || oper->type == RX_Operand_Zero_Indirect) - PR (PS, "%s", size_names[oper->size]); + PR (PS, "%s", get_size_name (oper->size)); } else switch (oper->type)