1 /* Print mips instructions for GDB, the GNU debugger, or for objdump.
2 Copyright (c) 1989, 91-97, 1998 Free Software Foundation, Inc.
5 This file is part of GDB, GAS, and the GNU binutils.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
24 #include "opcode/mips.h"
27 /* FIXME: These are needed to figure out if this is a mips16 symbol or
28 not. It would be better to think of a cleaner way to do this. */
32 static int print_insn_mips16 PARAMS ((bfd_vma, struct disassemble_info *));
33 static void print_mips16_insn_arg
34 PARAMS ((int, const struct mips_opcode *, int, boolean, int, bfd_vma,
35 struct disassemble_info *));
37 /* Mips instructions are never longer than this many bytes. */
40 static void print_insn_arg PARAMS ((const char *, unsigned long, bfd_vma,
41 struct disassemble_info *));
42 static int _print_insn_mips PARAMS ((bfd_vma, unsigned long int,
43 struct disassemble_info *));
46 /* FIXME: This should be shared with gdb somehow. */
47 #define REGISTER_NAMES \
48 { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \
49 "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", \
50 "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
51 "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra", \
52 "sr", "lo", "hi", "bad", "cause","pc", \
53 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
54 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
55 "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",\
56 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",\
57 "fsr", "fir", "fp", "inx", "rand", "tlblo","ctxt", "tlbhi",\
61 static CONST char * CONST reg_names[] = REGISTER_NAMES;
63 /* The mips16 register names. */
64 static const char * const mips16_reg_names[] =
66 "s0", "s1", "v0", "v1", "a0", "a1", "a2", "a3"
71 print_insn_arg (d, l, pc, info)
73 register unsigned long int l;
75 struct disassemble_info *info;
84 /* start-sanitize-vr5400 */
87 /* end-sanitize-vr5400 */
88 /* start-sanitize-r5900 */
91 /* end-sanitize-r5900 */
92 (*info->fprintf_func) (info->stream, "%c", *d);
99 (*info->fprintf_func) (info->stream, "$%s",
100 reg_names[(l >> OP_SH_RS) & OP_MASK_RS]);
105 (*info->fprintf_func) (info->stream, "$%s",
106 reg_names[(l >> OP_SH_RT) & OP_MASK_RT]);
111 (*info->fprintf_func) (info->stream, "0x%x",
112 (l >> OP_SH_IMMEDIATE) & OP_MASK_IMMEDIATE);
115 case 'j': /* same as i, but sign-extended */
117 delta = (l >> OP_SH_DELTA) & OP_MASK_DELTA;
120 (*info->fprintf_func) (info->stream, "%d",
125 (*info->fprintf_func) (info->stream, "0x%x",
126 (unsigned int) ((l >> OP_SH_PREFX)
131 (*info->fprintf_func) (info->stream, "0x%x",
132 (unsigned int) ((l >> OP_SH_CACHE)
137 (*info->print_address_func)
138 (((pc & 0xF0000000) | (((l >> OP_SH_TARGET) & OP_MASK_TARGET) << 2)),
143 /* sign extend the displacement */
144 delta = (l >> OP_SH_DELTA) & OP_MASK_DELTA;
147 (*info->print_address_func)
148 ((delta << 2) + pc + 4,
153 (*info->fprintf_func) (info->stream, "$%s",
154 reg_names[(l >> OP_SH_RD) & OP_MASK_RD]);
158 (*info->fprintf_func) (info->stream, "$%s", reg_names[0]);
162 (*info->fprintf_func) (info->stream, "0x%x",
163 (l >> OP_SH_SHAMT) & OP_MASK_SHAMT);
167 (*info->fprintf_func) (info->stream, "0x%x",
168 (l >> OP_SH_CODE) & OP_MASK_CODE);
173 (*info->fprintf_func) (info->stream, "0x%x",
174 (l >> OP_SH_CODE2) & OP_MASK_CODE2);
178 (*info->fprintf_func) (info->stream, "0x%x",
179 (l >> OP_SH_COPZ) & OP_MASK_COPZ);
183 (*info->fprintf_func) (info->stream, "0x%x",
184 (l >> OP_SH_SYSCALL) & OP_MASK_SYSCALL);
189 (*info->fprintf_func) (info->stream, "$f%d",
190 (l >> OP_SH_FS) & OP_MASK_FS);
193 /* start-sanitize-r5900 */
195 (*info->fprintf_func) (info->stream, "0x%x",
200 (*info->fprintf_func) (info->stream, "vi27");
204 (*info->fprintf_func) (info->stream, "vf%d",
205 (l >> OP_SH_FT) & OP_MASK_FT);
208 (*info->fprintf_func) (info->stream, "vf%d",
209 (l >> OP_SH_FS) & OP_MASK_FS);
212 (*info->fprintf_func) (info->stream, "vf%d",
213 (l >> OP_SH_FD) & OP_MASK_FD);
217 (*info->fprintf_func) (info->stream, "vi%d",
218 (l >> OP_SH_FT) & OP_MASK_FT);
221 (*info->fprintf_func) (info->stream, "vi%d",
222 (l >> OP_SH_FS) & OP_MASK_FS);
225 (*info->fprintf_func) (info->stream, "vi%d",
226 (l >> OP_SH_FD) & OP_MASK_FD);
230 (*info->fprintf_func) (info->stream, "vf%d",
231 (l >> OP_SH_FT) & OP_MASK_FT);
232 switch ((l >> 23) & 0x3)
235 (*info->fprintf_func) (info->stream, "x");
238 (*info->fprintf_func) (info->stream, "y");
241 (*info->fprintf_func) (info->stream, "z");
244 (*info->fprintf_func) (info->stream, "w");
252 (*info->fprintf_func) (info->stream, ".xyz\t");
256 (*info->fprintf_func) (info->stream, ".");
258 (*info->fprintf_func) (info->stream, "w");
260 (*info->fprintf_func) (info->stream, "x");
262 (*info->fprintf_func) (info->stream, "y");
264 (*info->fprintf_func) (info->stream, "z");
265 (*info->fprintf_func) (info->stream, "\t");
269 (*info->fprintf_func) (info->stream, "vf%d",
270 (l >> OP_SH_FS) & OP_MASK_FS);
271 switch ((l >> 21) & 0x3)
274 (*info->fprintf_func) (info->stream, "x");
277 (*info->fprintf_func) (info->stream, "y");
280 (*info->fprintf_func) (info->stream, "z");
283 (*info->fprintf_func) (info->stream, "w");
288 (*info->fprintf_func) (info->stream, "I");
292 (*info->fprintf_func) (info->stream, "Q");
296 (*info->fprintf_func) (info->stream, "R");
300 (*info->fprintf_func) (info->stream, "ACC");
304 delta = (l >> 6) & 0x7fff;
306 (*info->print_address_func) (delta, info);
309 /* end-sanitize-r5900 */
313 (*info->fprintf_func) (info->stream, "$f%d",
314 (l >> OP_SH_FT) & OP_MASK_FT);
318 (*info->fprintf_func) (info->stream, "$f%d",
319 (l >> OP_SH_FD) & OP_MASK_FD);
323 (*info->fprintf_func) (info->stream, "$f%d",
324 (l >> OP_SH_FR) & OP_MASK_FR);
328 (*info->fprintf_func) (info->stream, "$%d",
329 (l >> OP_SH_RT) & OP_MASK_RT);
333 (*info->fprintf_func) (info->stream, "$%d",
334 (l >> OP_SH_RD) & OP_MASK_RD);
338 (*info->fprintf_func) (info->stream, "$fcc%d",
339 (l >> OP_SH_BCC) & OP_MASK_BCC);
343 (*info->fprintf_func) (info->stream, "$fcc%d",
344 (l >> OP_SH_CCC) & OP_MASK_CCC);
348 (*info->fprintf_func) (info->stream, "%d",
349 (l >> OP_SH_PERFREG) & OP_MASK_PERFREG);
352 /* start-sanitize-vr5400 */
354 (*info->fprintf_func) (info->stream, "%d",
355 (l >> OP_SH_VECBYTE) & OP_MASK_VECBYTE);
359 (*info->fprintf_func) (info->stream, "%d",
360 (l >> OP_SH_VECALIGN) & OP_MASK_VECALIGN);
362 /* end-sanitize-vr5400 */
365 /* xgettext:c-format */
366 (*info->fprintf_func) (info->stream,
367 _("# internal error, undefined modifier(%c)"),
373 /* Print the mips instruction at address MEMADDR in debugged memory,
374 on using INFO. Returns length of the instruction, in bytes, which is
375 always 4. BIGENDIAN must be 1 if this is big-endian code, 0 if
376 this is little-endian code. */
379 _print_insn_mips (memaddr, word, info)
381 unsigned long int word;
382 struct disassemble_info *info;
384 register const struct mips_opcode *op;
385 int target_processor, mips_isa;
386 static boolean init = 0;
387 static const struct mips_opcode *mips_hash[OP_MASK_OP + 1];
389 /* Build a hash table to shorten the search time. */
394 for (i = 0; i <= OP_MASK_OP; i++)
396 for (op = mips_opcodes; op < &mips_opcodes[NUMOPCODES]; op++)
398 if (op->pinfo == INSN_MACRO)
400 if (i == ((op->match >> OP_SH_OP) & OP_MASK_OP))
413 /* start-sanitize-tx19 */
414 case bfd_mach_mips1900:
415 target_processor = 1900;
418 /* end-sanitize-tx19 */
419 case bfd_mach_mips3000:
420 target_processor = 3000;
423 case bfd_mach_mips3900:
424 target_processor = 3900;
427 case bfd_mach_mips4000:
428 target_processor = 4000;
431 case bfd_mach_mips4010:
432 target_processor = 4010;
435 case bfd_mach_mips4100:
436 target_processor = 4100;
439 case bfd_mach_mips4300:
440 target_processor = 4300;
443 /* start-sanitize-vr4320 */
444 case bfd_mach_mips4320:
445 target_processor = 4320;
448 /* end-sanitize-vr4320 */
449 case bfd_mach_mips4400:
450 target_processor = 4400;
453 case bfd_mach_mips4600:
454 target_processor = 4600;
457 case bfd_mach_mips4650:
458 target_processor = 4650;
461 /* start-sanitize-tx49 */
462 case bfd_mach_mips4900:
463 target_processor = 4900;
466 /* end-sanitize-tx49 */
467 case bfd_mach_mips5000:
468 target_processor = 5000;
471 /* start-sanitize-vr5400 */
472 case bfd_mach_mips5400:
473 target_processor = 5400;
476 /* end-sanitize-vr5400 */
477 /* start-sanitize-r5900 */
478 case bfd_mach_mips5900:
479 target_processor = 5900;
482 /* end-sanitize-r5900 */
483 case bfd_mach_mips6000:
484 target_processor = 6000;
487 case bfd_mach_mips8000:
488 target_processor = 8000;
491 case bfd_mach_mips10000:
492 target_processor = 10000;
495 case bfd_mach_mips16:
496 target_processor = 16;
500 target_processor = 3000;
506 info->bytes_per_chunk = 4;
507 info->display_endian = info->endian;
509 op = mips_hash[(word >> OP_SH_OP) & OP_MASK_OP];
512 for (; op < &mips_opcodes[NUMOPCODES]; op++)
514 if (op->pinfo != INSN_MACRO && (word & op->mask) == op->match)
516 register const char *d;
519 if ((op->membership & INSN_ISA) == INSN_ISA1)
521 else if ((op->membership & INSN_ISA) == INSN_ISA2)
523 else if ((op->membership & INSN_ISA) == INSN_ISA3)
525 else if ((op->membership & INSN_ISA) == INSN_ISA4)
530 if (insn_isa > mips_isa
531 && (target_processor == 4650
532 && op->membership & INSN_4650) == 0
533 && (target_processor == 4010
534 && op->membership & INSN_4010) == 0
535 && (target_processor == 4100
536 && op->membership & INSN_4100) == 0
537 /* start-sanitize-vr4320 */
538 && (target_processor == 4320
539 && op->membership & INSN_4320) == 0
540 /* end-sanitize-vr4320 */
541 /* start-sanitize-vr5400 */
542 && (target_processor == 5400
543 && op->membership & INSN_5400) == 0
544 /* end-sanitize-vr5400 */
545 /* start-sanitize-r5900 */
546 && (target_processor == 5900
547 && op->membership & INSN_5900) == 0
548 /* end-sanitize-r5900 */
549 /* start-sanitize-tx49 */
550 && (target_processor == 4900
551 && op->membership & INSN_4900) == 0
552 /* end-sanitize-tx49 */
553 && (target_processor == 3900
554 && op->membership & INSN_3900) == 0)
557 (*info->fprintf_func) (info->stream, "%s", op->name);
560 if (d != NULL && *d != '\0')
562 /* start-sanitize-r5900 */
563 /* If this is an opcode completer, then do not emit
564 a tab after the opcode. */
565 if (*d != '&' && *d != ';')
566 /* end-sanitize-r5900 */
567 (*info->fprintf_func) (info->stream, "\t");
568 for (; *d != '\0'; d++)
569 /* start-sanitize-r5900 */
570 /* If this is an escape character, go ahead and print the
571 next character in the arg string verbatim. */
575 (*info->fprintf_func) (info->stream, "%c", *d);
578 /* end-sanitize-r5900 */
579 print_insn_arg (d, word, memaddr, info);
587 /* Handle undefined instructions. */
588 (*info->fprintf_func) (info->stream, "0x%x", word);
593 print_insn_big_mips (memaddr, info)
595 struct disassemble_info *info;
601 || (info->flavour == bfd_target_elf_flavour
602 && info->symbols != NULL
603 && ((*(elf_symbol_type **) info->symbols)->internal_elf_sym.st_other
605 return print_insn_mips16 (memaddr, info);
607 status = (*info->read_memory_func) (memaddr, buffer, 4, info);
609 return _print_insn_mips (memaddr, (unsigned long) bfd_getb32 (buffer),
613 (*info->memory_error_func) (status, memaddr, info);
619 print_insn_little_mips (memaddr, info)
621 struct disassemble_info *info;
626 /* start-sanitize-sky */
629 /* bfd_mach_dvp_p is a macro which may evaluate its arguments more than
630 once. Since dvp_mach_type is a function, ensure it's only called
632 int mach = dvp_info_mach_type (info);
634 if (bfd_mach_dvp_p (info->mach)
635 || bfd_mach_dvp_p (mach))
636 return print_insn_dvp (memaddr, info);
639 /* end-sanitize-sky */
642 || (info->flavour == bfd_target_elf_flavour
643 && info->symbols != NULL
644 && ((*(elf_symbol_type **) info->symbols)->internal_elf_sym.st_other
646 return print_insn_mips16 (memaddr, info);
648 status = (*info->read_memory_func) (memaddr, buffer, 4, info);
650 return _print_insn_mips (memaddr, (unsigned long) bfd_getl32 (buffer),
654 (*info->memory_error_func) (status, memaddr, info);
659 /* Disassemble mips16 instructions. */
662 print_insn_mips16 (memaddr, info)
664 struct disassemble_info *info;
672 const struct mips_opcode *op, *opend;
674 info->bytes_per_chunk = 2;
675 info->display_endian = info->endian;
677 info->insn_info_valid = 1;
678 info->branch_delay_insns = 0;
680 info->insn_type = dis_nonbranch;
684 status = (*info->read_memory_func) (memaddr, buffer, 2, info);
687 (*info->memory_error_func) (status, memaddr, info);
693 if (info->endian == BFD_ENDIAN_BIG)
694 insn = bfd_getb16 (buffer);
696 insn = bfd_getl16 (buffer);
698 /* Handle the extend opcode specially. */
700 if ((insn & 0xf800) == 0xf000)
703 extend = insn & 0x7ff;
707 status = (*info->read_memory_func) (memaddr, buffer, 2, info);
710 (*info->fprintf_func) (info->stream, "extend 0x%x",
711 (unsigned int) extend);
712 (*info->memory_error_func) (status, memaddr, info);
716 if (info->endian == BFD_ENDIAN_BIG)
717 insn = bfd_getb16 (buffer);
719 insn = bfd_getl16 (buffer);
721 /* Check for an extend opcode followed by an extend opcode. */
722 if ((insn & 0xf800) == 0xf000)
724 (*info->fprintf_func) (info->stream, "extend 0x%x",
725 (unsigned int) extend);
726 info->insn_type = dis_noninsn;
733 /* FIXME: Should probably use a hash table on the major opcode here. */
735 opend = mips16_opcodes + bfd_mips16_num_opcodes;
736 for (op = mips16_opcodes; op < opend; op++)
738 if (op->pinfo != INSN_MACRO && (insn & op->mask) == op->match)
742 if (strchr (op->args, 'a') != NULL)
746 (*info->fprintf_func) (info->stream, "extend 0x%x",
747 (unsigned int) extend);
748 info->insn_type = dis_noninsn;
756 status = (*info->read_memory_func) (memaddr, buffer, 2,
761 if (info->endian == BFD_ENDIAN_BIG)
762 extend = bfd_getb16 (buffer);
764 extend = bfd_getl16 (buffer);
769 (*info->fprintf_func) (info->stream, "%s", op->name);
770 if (op->args[0] != '\0')
771 (*info->fprintf_func) (info->stream, "\t");
773 for (s = op->args; *s != '\0'; s++)
777 && (((insn >> MIPS16OP_SH_RX) & MIPS16OP_MASK_RX)
778 == ((insn >> MIPS16OP_SH_RY) & MIPS16OP_MASK_RY)))
780 /* Skip the register and the comma. */
786 && (((insn >> MIPS16OP_SH_RZ) & MIPS16OP_MASK_RZ)
787 == ((insn >> MIPS16OP_SH_RX) & MIPS16OP_MASK_RX)))
789 /* Skip the register and the comma. */
793 print_mips16_insn_arg (*s, op, insn, use_extend, extend, memaddr,
797 if ((op->pinfo & INSN_UNCOND_BRANCH_DELAY) != 0)
799 info->branch_delay_insns = 1;
800 if (info->insn_type != dis_jsr)
801 info->insn_type = dis_branch;
809 (*info->fprintf_func) (info->stream, "0x%x", extend | 0xf000);
810 (*info->fprintf_func) (info->stream, "0x%x", insn);
811 info->insn_type = dis_noninsn;
816 /* Disassemble an operand for a mips16 instruction. */
819 print_mips16_insn_arg (type, op, l, use_extend, extend, memaddr, info)
821 const struct mips_opcode *op;
826 struct disassemble_info *info;
833 (*info->fprintf_func) (info->stream, "%c", type);
838 (*info->fprintf_func) (info->stream, "$%s",
839 mips16_reg_names[((l >> MIPS16OP_SH_RY)
840 & MIPS16OP_MASK_RY)]);
845 (*info->fprintf_func) (info->stream, "$%s",
846 mips16_reg_names[((l >> MIPS16OP_SH_RX)
847 & MIPS16OP_MASK_RX)]);
851 (*info->fprintf_func) (info->stream, "$%s",
852 mips16_reg_names[((l >> MIPS16OP_SH_RZ)
853 & MIPS16OP_MASK_RZ)]);
857 (*info->fprintf_func) (info->stream, "$%s",
858 mips16_reg_names[((l >> MIPS16OP_SH_MOVE32Z)
859 & MIPS16OP_MASK_MOVE32Z)]);
863 (*info->fprintf_func) (info->stream, "$%s", reg_names[0]);
867 (*info->fprintf_func) (info->stream, "$%s", reg_names[29]);
871 (*info->fprintf_func) (info->stream, "$pc");
875 (*info->fprintf_func) (info->stream, "$%s", reg_names[31]);
879 (*info->fprintf_func) (info->stream, "$%s",
880 reg_names[((l >> MIPS16OP_SH_REGR32)
881 & MIPS16OP_MASK_REGR32)]);
885 (*info->fprintf_func) (info->stream, "$%s",
886 reg_names[MIPS16OP_EXTRACT_REG32R (l)]);
912 int immed, nbits, shift, signedp, extbits, pcrel, extu, branch;
924 immed = (l >> MIPS16OP_SH_RZ) & MIPS16OP_MASK_RZ;
930 immed = (l >> MIPS16OP_SH_RX) & MIPS16OP_MASK_RX;
936 immed = (l >> MIPS16OP_SH_RZ) & MIPS16OP_MASK_RZ;
942 immed = (l >> MIPS16OP_SH_RX) & MIPS16OP_MASK_RX;
948 immed = (l >> MIPS16OP_SH_IMM4) & MIPS16OP_MASK_IMM4;
954 immed = (l >> MIPS16OP_SH_IMM5) & MIPS16OP_MASK_IMM5;
955 info->insn_type = dis_dref;
961 immed = (l >> MIPS16OP_SH_IMM5) & MIPS16OP_MASK_IMM5;
962 info->insn_type = dis_dref;
968 immed = (l >> MIPS16OP_SH_IMM5) & MIPS16OP_MASK_IMM5;
969 if ((op->pinfo & MIPS16_INSN_READ_PC) == 0
970 && (op->pinfo & MIPS16_INSN_READ_SP) == 0)
972 info->insn_type = dis_dref;
979 immed = (l >> MIPS16OP_SH_IMM5) & MIPS16OP_MASK_IMM5;
980 info->insn_type = dis_dref;
985 immed = (l >> MIPS16OP_SH_IMM5) & MIPS16OP_MASK_IMM5;
990 immed = (l >> MIPS16OP_SH_IMM6) & MIPS16OP_MASK_IMM6;
994 immed = (l >> MIPS16OP_SH_IMM8) & MIPS16OP_MASK_IMM8;
999 immed = (l >> MIPS16OP_SH_IMM8) & MIPS16OP_MASK_IMM8;
1000 /* FIXME: This might be lw, or it might be addiu to $sp or
1001 $pc. We assume it's load. */
1002 info->insn_type = dis_dref;
1003 info->data_size = 4;
1008 immed = (l >> MIPS16OP_SH_IMM8) & MIPS16OP_MASK_IMM8;
1009 info->insn_type = dis_dref;
1010 info->data_size = 8;
1014 immed = (l >> MIPS16OP_SH_IMM8) & MIPS16OP_MASK_IMM8;
1019 immed = (l >> MIPS16OP_SH_IMM8) & MIPS16OP_MASK_IMM8;
1025 immed = (l >> MIPS16OP_SH_IMM8) & MIPS16OP_MASK_IMM8;
1030 immed = (l >> MIPS16OP_SH_IMM8) & MIPS16OP_MASK_IMM8;
1034 info->insn_type = dis_condbranch;
1038 immed = (l >> MIPS16OP_SH_IMM11) & MIPS16OP_MASK_IMM11;
1042 info->insn_type = dis_branch;
1047 immed = (l >> MIPS16OP_SH_IMM8) & MIPS16OP_MASK_IMM8;
1049 /* FIXME: This can be lw or la. We assume it is lw. */
1050 info->insn_type = dis_dref;
1051 info->data_size = 4;
1056 immed = (l >> MIPS16OP_SH_IMM5) & MIPS16OP_MASK_IMM5;
1058 info->insn_type = dis_dref;
1059 info->data_size = 8;
1064 immed = (l >> MIPS16OP_SH_IMM5) & MIPS16OP_MASK_IMM5;
1073 if (signedp && immed >= (1 << (nbits - 1)))
1074 immed -= 1 << nbits;
1076 if ((type == '<' || type == '>' || type == '[' || type == '[')
1083 immed |= ((extend & 0x1f) << 11) | (extend & 0x7e0);
1084 else if (extbits == 15)
1085 immed |= ((extend & 0xf) << 11) | (extend & 0x7f0);
1087 immed = ((extend >> 6) & 0x1f) | (extend & 0x20);
1088 immed &= (1 << extbits) - 1;
1089 if (! extu && immed >= (1 << (extbits - 1)))
1090 immed -= 1 << extbits;
1094 (*info->fprintf_func) (info->stream, "%d", immed);
1103 baseaddr = memaddr + 2;
1105 else if (use_extend)
1106 baseaddr = memaddr - 2;
1114 /* If this instruction is in the delay slot of a jr
1115 instruction, the base address is the address of the
1116 jr instruction. If it is in the delay slot of jalr
1117 instruction, the base address is the address of the
1118 jalr instruction. This test is unreliable: we have
1119 no way of knowing whether the previous word is
1120 instruction or data. */
1121 status = (*info->read_memory_func) (memaddr - 4, buffer, 2,
1124 && (((info->endian == BFD_ENDIAN_BIG
1125 ? bfd_getb16 (buffer)
1126 : bfd_getl16 (buffer))
1127 & 0xf800) == 0x1800))
1128 baseaddr = memaddr - 4;
1131 status = (*info->read_memory_func) (memaddr - 2, buffer,
1134 && (((info->endian == BFD_ENDIAN_BIG
1135 ? bfd_getb16 (buffer)
1136 : bfd_getl16 (buffer))
1137 & 0xf81f) == 0xe800))
1138 baseaddr = memaddr - 2;
1141 val = (baseaddr & ~ ((1 << shift) - 1)) + immed;
1142 (*info->print_address_func) (val, info);
1151 l = ((l & 0x1f) << 23) | ((l & 0x3e0) << 13) | (extend << 2);
1152 (*info->print_address_func) ((memaddr & 0xf0000000) | l, info);
1153 info->insn_type = dis_jsr;
1154 info->target = (memaddr & 0xf0000000) | l;
1155 info->branch_delay_insns = 1;
1161 int need_comma, amask, smask;
1165 l = (l >> MIPS16OP_SH_IMM6) & MIPS16OP_MASK_IMM6;
1167 amask = (l >> 3) & 7;
1169 if (amask > 0 && amask < 5)
1171 (*info->fprintf_func) (info->stream, "$%s", reg_names[4]);
1173 (*info->fprintf_func) (info->stream, "-$%s",
1174 reg_names[amask + 3]);
1178 smask = (l >> 1) & 3;
1181 (*info->fprintf_func) (info->stream, "%s??",
1182 need_comma ? "," : "");
1187 (*info->fprintf_func) (info->stream, "%s$%s",
1188 need_comma ? "," : "",
1191 (*info->fprintf_func) (info->stream, "-$%s",
1192 reg_names[smask + 15]);
1198 (*info->fprintf_func) (info->stream, "%s$%s",
1199 need_comma ? "," : "",
1204 if (amask == 5 || amask == 6)
1206 (*info->fprintf_func) (info->stream, "%s$f0",
1207 need_comma ? "," : "");
1209 (*info->fprintf_func) (info->stream, "-$f1");