X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=opcodes%2Fhppa-dis.c;h=93156da7cb029b3fff40288043040476f0e694cc;hb=3922b302645fda04da42a5279399578ae2f6206c;hp=56f355e87d1196d6787946b183fb1dc90e2fd36f;hpb=47b0e7ad8c60ea4b45b22ad5cb376f068991bc88;p=deliverable%2Fbinutils-gdb.git diff --git a/opcodes/hppa-dis.c b/opcodes/hppa-dis.c index 56f355e87d..93156da7cb 100644 --- a/opcodes/hppa-dis.c +++ b/opcodes/hppa-dis.c @@ -1,19 +1,20 @@ /* Disassembler for the PA-RISC. Somewhat derived from sparc-pinsn.c. - Copyright 1989, 1990, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2003, - 2005 Free Software Foundation, Inc. + Copyright (C) 1989-2020 Free Software Foundation, Inc. Contributed by the Center for Software Science at the University of Utah (pa-gdb-bugs@cs.utah.edu). - This program is free software; you can redistribute it and/or modify + This file is part of the GNU opcodes library. + + This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation; either version 3, or (at your option) + any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + It is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software @@ -21,7 +22,7 @@ MA 02110-1301, USA. */ #include "sysdep.h" -#include "dis-asm.h" +#include "disassemble.h" #include "libhppa.h" #include "opcode/hppa.h" @@ -84,7 +85,7 @@ static const char *const compare_cond_names[] = }; static const char *const compare_cond_64_names[] = { - "", ",*=", ",*<", ",*<=", ",*<<", ",*<<=", ",*sv", ",*od", + ",*", ",*=", ",*<", ",*<=", ",*<<", ",*<<=", ",*sv", ",*od", ",*tr", ",*<>", ",*>=", ",*>", ",*>>=", ",*>>", ",*nsv", ",*ev" }; static const char *const cmpib_cond_64_names[] = @@ -98,7 +99,7 @@ static const char *const add_cond_names[] = }; static const char *const add_cond_64_names[] = { - "", ",*=", ",*<", ",*<=", ",*nuv", ",*znv", ",*sv", ",*od", + ",*", ",*=", ",*<", ",*<=", ",*nuv", ",*znv", ",*sv", ",*od", ",*tr", ",*<>", ",*>=", ",*>", ",*uv", ",*vnz", ",*nsv", ",*ev" }; static const char *const wide_add_cond_names[] = @@ -112,7 +113,7 @@ static const char *const logical_cond_names[] = ",tr", ",<>", ",>=", ",>", 0, 0, 0, ",ev"}; static const char *const logical_cond_64_names[] = { - "", ",*=", ",*<", ",*<=", 0, 0, 0, ",*od", + ",*", ",*=", ",*<", ",*<=", 0, 0, 0, ",*od", ",*tr", ",*<>", ",*>=", ",*>", 0, 0, 0, ",*ev"}; static const char *const unit_cond_names[] = { @@ -121,7 +122,7 @@ static const char *const unit_cond_names[] = }; static const char *const unit_cond_64_names[] = { - "", ",*swz", ",*sbz", ",*shz", ",*sdc", ",*swc", ",*sbc", ",*shc", + ",*", ",*swz", ",*sbz", ",*shz", ",*sdc", ",*swc", ",*sbc", ",*shc", ",*tr", ",*nwz", ",*nbz", ",*nhz", ",*ndc", ",*nwc", ",*nbc", ",*nhc" }; static const char *const shift_cond_names[] = @@ -130,7 +131,7 @@ static const char *const shift_cond_names[] = }; static const char *const shift_cond_64_names[] = { - "", ",*=", ",*<", ",*od", ",*tr", ",*<>", ",*>=", ",*ev" + ",*", ",*=", ",*<", ",*od", ",*tr", ",*<>", ",*>=", ",*ev" }; static const char *const bb_cond_64_names[] = { @@ -174,13 +175,13 @@ static const char *const add_compl_names[] = { 0, "", ",l", ",tsv" }; static void fput_reg (unsigned reg, disassemble_info *info) { - (*info->fprintf_func) (info->stream, reg ? reg_names[reg] : "r0"); + (*info->fprintf_func) (info->stream, "%s", reg ? reg_names[reg] : "r0"); } static void fput_fp_reg (unsigned reg, disassemble_info *info) { - (*info->fprintf_func) (info->stream, reg ? fp_reg_names[reg] : "fr0"); + (*info->fprintf_func) (info->stream, "%s", reg ? fp_reg_names[reg] : "fr0"); } static void @@ -197,7 +198,7 @@ fput_fp_reg_r (unsigned reg, disassemble_info *info) static void fput_creg (unsigned reg, disassemble_info *info) { - (*info->fprintf_func) (info->stream, control_reg[reg]); + (*info->fprintf_func) (info->stream, "%s", control_reg[reg]); } /* Print constants with sign. */ @@ -206,7 +207,7 @@ static void fput_const (unsigned num, disassemble_info *info) { if ((int) num < 0) - (*info->fprintf_func) (info->stream, "-%x", - (int) num); + (*info->fprintf_func) (info->stream, "-%x", -num); else (*info->fprintf_func) (info->stream, "%x", num); } @@ -288,7 +289,7 @@ extract_14 (unsigned word) static int extract_16 (unsigned word) { - int m15, m0, m1; + unsigned m15, m0, m1; m0 = GET_BIT (word, 16); m1 = GET_BIT (word, 17); @@ -303,7 +304,7 @@ extract_16 (unsigned word) static int extract_21 (unsigned word) { - int val; + unsigned val; word &= MASK_21; word <<= 11; @@ -424,7 +425,7 @@ print_insn_hppa (bfd_vma memaddr, disassemble_info *info) fput_fp_reg (GET_FIELD (insn, 6, 10), info); break; - /* 'fA' will not generate a space before the regsiter + /* 'fA' will not generate a space before the register name. Normally that is fine. Except that it causes problems with xmpyu which has no FP format completer. */ @@ -618,7 +619,7 @@ print_insn_hppa (bfd_vma memaddr, disassemble_info *info) read_write_names[GET_FIELD (insn, 25, 25)]); break; case 'W': - (*info->fprintf_func) (info->stream, ",w"); + (*info->fprintf_func) (info->stream, ",w "); break; case 'r': if (GET_FIELD (insn, 23, 26) == 5) @@ -912,6 +913,7 @@ print_insn_hppa (bfd_vma memaddr, disassemble_info *info) fput_const (extract_14 (insn), info); break; case 'k': + fputs_filtered ("L%", info); fput_const (extract_21 (insn), info); break; case '<': @@ -951,12 +953,12 @@ print_insn_hppa (bfd_vma memaddr, disassemble_info *info) case 'Z': /* addil %r1 implicit output. */ - (*info->fprintf_func) (info->stream, "%%r1"); + fputs_filtered ("r1", info); break; case 'Y': /* be,l %sr0,%r31 implicit output. */ - (*info->fprintf_func) (info->stream, "%%sr0,%%r31"); + fputs_filtered ("sr0,r31", info); break; case '@': @@ -972,7 +974,7 @@ print_insn_hppa (bfd_vma memaddr, disassemble_info *info) GET_FIELD (insn, 22, 25)); break; case '!': - (*info->fprintf_func) (info->stream, "%%sar"); + fputs_filtered ("sar", info); break; case 'p': (*info->fprintf_func) (info->stream, "%d", @@ -1096,12 +1098,12 @@ print_insn_hppa (bfd_vma memaddr, disassemble_info *info) case '#': { - int sign = GET_FIELD (insn, 31, 31); - int imm10 = GET_FIELD (insn, 18, 27); - int disp; + unsigned sign = GET_FIELD (insn, 31, 31); + unsigned imm10 = GET_FIELD (insn, 18, 27); + unsigned disp; if (sign) - disp = (-1 << 10) | imm10; + disp = (-1U << 10) | imm10; else disp = imm10; @@ -1112,12 +1114,12 @@ print_insn_hppa (bfd_vma memaddr, disassemble_info *info) case 'K': case 'd': { - int sign = GET_FIELD (insn, 31, 31); - int imm11 = GET_FIELD (insn, 18, 28); - int disp; + unsigned sign = GET_FIELD (insn, 31, 31); + unsigned imm11 = GET_FIELD (insn, 18, 28); + unsigned disp; if (sign) - disp = (-1 << 11) | imm11; + disp = (-1U << 11) | imm11; else disp = imm11; @@ -1218,7 +1220,7 @@ print_insn_hppa (bfd_vma memaddr, disassemble_info *info) (memaddr + 8 + extract_22 (insn), info); break; case 'L': - fputs_filtered (",%r2", info); + fputs_filtered (",rp", info); break; default: (*info->fprintf_func) (info->stream, "%c", *s);