aboutsummaryrefslogtreecommitdiff
path: root/opcodes/sh64-dis.c
diff options
context:
space:
mode:
authorJoern Rennecke <joern.rennecke@embecosm.com>2002-05-17 14:36:46 +0000
committerJoern Rennecke <joern.rennecke@embecosm.com>2002-05-17 14:36:46 +0000
commit1c509ca8216de106f508b463a13ceea60ccce878 (patch)
treeb99f4a21d27157edf9e92d959e57c8e72c4a8a29 /opcodes/sh64-dis.c
parentef60b7ff0e85790141643fc60f82d8d6e86ae014 (diff)
downloadgdb-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/sh64-dis.c')
-rw-r--r--opcodes/sh64-dis.c43
1 files changed, 11 insertions, 32 deletions
diff --git a/opcodes/sh64-dis.c b/opcodes/sh64-dis.c
index 2c76067..10c0f31 100644
--- a/opcodes/sh64-dis.c
+++ b/opcodes/sh64-dis.c
@@ -55,10 +55,6 @@ static unsigned long *shmedia_opcode_mask_table;
static void initialize_shmedia_opcode_mask_table PARAMS ((void));
static int print_insn_shmedia PARAMS ((bfd_vma, disassemble_info *));
-static int print_insn_sh64x
- PARAMS ((bfd_vma, disassemble_info *,
- int (*) PARAMS ((bfd_vma, struct disassemble_info *)),
- enum bfd_endian));
static const char *creg_name PARAMS ((int));
static boolean init_sh64_disasm_info PARAMS ((struct disassemble_info *));
static enum sh64_elf_cr_type sh64_get_contents_type_disasm
@@ -555,15 +551,15 @@ print_insn_sh64x_media (memaddr, info)
return print_insn_shmedia (memaddr, info);
}
-/* Main entry to disassemble SHcompact or SHmedia insns. */
+/* Main entry to disassemble SHmedia insns.
+ If we see an SHcompact instruction, return -2. */
-static int
-print_insn_sh64x (memaddr, info, pfun_compact, endian)
+int
+print_insn_sh64 (memaddr, info)
bfd_vma memaddr;
struct disassemble_info *info;
- int (*pfun_compact) PARAMS ((bfd_vma, struct disassemble_info *));
- enum bfd_endian endian;
{
+ enum bfd_endian endian = info->endian;
enum sh64_elf_cr_type cr_type;
if (info->private_data == NULL && ! init_sh64_disasm_info (info))
@@ -575,6 +571,10 @@ print_insn_sh64x (memaddr, info, pfun_compact, endian)
int length = 4 - (memaddr % 4);
info->display_endian = endian;
+ /* If we got an uneven address to indicate SHmedia, adjust it. */
+ if (cr_type == CRT_SH5_ISA32 && length == 3)
+ memaddr--, length = 4;
+
/* Only disassemble on four-byte boundaries. Addresses that are not
a multiple of four can happen after a data region. */
if (cr_type == CRT_SH5_ISA32 && length == 4)
@@ -633,27 +633,6 @@ print_insn_sh64x (memaddr, info, pfun_compact, endian)
}
}
- return (*pfun_compact) (memaddr, info);
-}
-
-/* Main entry to disassemble SHcompact or SHmedia insns, big endian. */
-
-int
-print_insn_sh64 (memaddr, info)
- bfd_vma memaddr;
- struct disassemble_info *info;
-{
- return
- print_insn_sh64x (memaddr, info, print_insn_sh, BFD_ENDIAN_BIG);
-}
-
-/* Main entry to disassemble SHcompact or SHmedia insns, little endian. */
-
-int
-print_insn_sh64l (memaddr, info)
- bfd_vma memaddr;
- struct disassemble_info *info;
-{
- return
- print_insn_sh64x (memaddr, info, print_insn_shl, BFD_ENDIAN_LITTLE);
+ /* SH1 .. SH4 instruction, let caller handle it. */
+ return -2;
}