diff options
author | Joern Rennecke <joern.rennecke@embecosm.com> | 2002-05-17 14:36:46 +0000 |
---|---|---|
committer | Joern Rennecke <joern.rennecke@embecosm.com> | 2002-05-17 14:36:46 +0000 |
commit | 1c509ca8216de106f508b463a13ceea60ccce878 (patch) | |
tree | b99f4a21d27157edf9e92d959e57c8e72c4a8a29 /opcodes/sh-dis.c | |
parent | ef60b7ff0e85790141643fc60f82d8d6e86ae014 (diff) | |
download | gdb-1c509ca8216de106f508b463a13ceea60ccce878.zip gdb-1c509ca8216de106f508b463a13ceea60ccce878.tar.gz gdb-1c509ca8216de106f508b463a13ceea60ccce878.tar.bz2 |
print_insn_sh cleanup:
include:
* dis-asm.h (print_insn_shl, print_insn_sh64l): Remove prototype.
gdb:
* sh-tdep.c (gdb_print_insn_sh64): Delete.
(gdb_print_insn_sh): Just set info->endian and use print_insn_sh.
(sh_gdbarch_init): Always use gdb_print_insn_sh.
opcodes:
* disassemble.c (disassembler): Just use print_insn_sh for bfd_arch_sh.
* sh-dis.c (LITTLE_BIT): Delete.
(print_insn_sh, print_insn_shl): Deleted.
(print_insn_shx): Renamed to
(print_insn_sh). No longer static. Handle SHmedia instructions.
Use info->endian to determine endianness.
* sh64-dis.c (print_insn_sh64, print_insn_sh64l): Delete.
(print_insn_sh64x): No longer static. Renamed to
(print_insn_sh64). Removed pfun_compact and endian arguments.
If we got an uneven address to indicate SHmedia, adjust it.
Return -2 for SHcompact instructions.
sim/sh64:
* sim-if.c (sh64_disassemble_insn): Use print_insn_sh instead of
print_insn_shl.
Diffstat (limited to 'opcodes/sh-dis.c')
-rw-r--r-- | opcodes/sh-dis.c | 46 |
1 files changed, 12 insertions, 34 deletions
diff --git a/opcodes/sh-dis.c b/opcodes/sh-dis.c index 92d7139..54b91b7 100644 --- a/opcodes/sh-dis.c +++ b/opcodes/sh-dis.c @@ -24,14 +24,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sh-opc.h" #include "dis-asm.h" -#define LITTLE_BIT 2 - static void print_movxy PARAMS ((sh_opcode_info *, int, int, fprintf_ftype, void *)); static void print_insn_ddt PARAMS ((int, struct disassemble_info *)); static void print_dsp_reg PARAMS ((int, fprintf_ftype, void *)); static void print_insn_ppi PARAMS ((int, struct disassemble_info *)); -static int print_insn_shx PARAMS ((bfd_vma, struct disassemble_info *)); static void print_movxy (op, rn, rm, fprintf_fn, stream) @@ -286,8 +283,8 @@ print_insn_ppi (field_b, info) fprintf_fn (stream, ".word 0x%x", field_b); } -static int -print_insn_shx (memaddr, info) +int +print_insn_sh (memaddr, info) bfd_vma memaddr; struct disassemble_info *info; { @@ -324,6 +321,11 @@ print_insn_shx (memaddr, info) target_arch = arch_sh4; break; case bfd_mach_sh5: +#ifdef INCLUDE_SHMEDIA + status = print_insn_sh64 (memaddr, info); + if (status != -2) + return status; +#endif /* When we get here for sh64, it's because we want to disassemble SHcompact, i.e. arch_sh4. */ target_arch = arch_sh4; @@ -340,7 +342,7 @@ print_insn_shx (memaddr, info) return -1; } - if (info->flags & LITTLE_BIT) + if (info->endian == BFD_ENDIAN_LITTLE) { nibs[0] = (insn[1] >> 4) & 0xf; nibs[1] = insn[1] & 0xf; @@ -371,7 +373,7 @@ print_insn_shx (memaddr, info) return -1; } - if (info->flags & LITTLE_BIT) + if (info->endian == BFD_ENDIAN_LITTLE) field_b = insn[1] << 8 | insn[0]; else field_b = insn[0] << 8 | insn[1]; @@ -677,7 +679,7 @@ print_insn_shx (memaddr, info) { info->flags |= 1; fprintf_fn (stream, "\t(slot "); - print_insn_shx (memaddr + 2, info); + print_insn_sh (memaddr + 2, info); info->flags &= ~1; fprintf_fn (stream, ")"); return 4; @@ -700,14 +702,14 @@ print_insn_shx (memaddr, info) if (size == 2) { - if ((info->flags & LITTLE_BIT) != 0) + if (info->endian == BFD_ENDIAN_LITTLE) val = bfd_getl16 (bytes); else val = bfd_getb16 (bytes); } else { - if ((info->flags & LITTLE_BIT) != 0) + if (info->endian == BFD_ENDIAN_LITTLE) val = bfd_getl32 (bytes); else val = bfd_getb32 (bytes); @@ -724,27 +726,3 @@ print_insn_shx (memaddr, info) fprintf_fn (stream, ".word 0x%x%x%x%x", nibs[0], nibs[1], nibs[2], nibs[3]); return 2; } - -int -print_insn_shl (memaddr, info) - bfd_vma memaddr; - struct disassemble_info *info; -{ - int r; - - info->flags = LITTLE_BIT; - r = print_insn_shx (memaddr, info); - return r; -} - -int -print_insn_sh (memaddr, info) - bfd_vma memaddr; - struct disassemble_info *info; -{ - int r; - - info->flags = 0; - r = print_insn_shx (memaddr, info); - return r; -} |