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 | |
parent | ef60b7ff0e85790141643fc60f82d8d6e86ae014 (diff) | |
download | fsf-binutils-gdb-1c509ca8216de106f508b463a13ceea60ccce878.zip fsf-binutils-gdb-1c509ca8216de106f508b463a13ceea60ccce878.tar.gz fsf-binutils-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.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/sh-tdep.c | 26 | ||||
-rw-r--r-- | include/ChangeLog | 4 | ||||
-rw-r--r-- | include/dis-asm.h | 2 | ||||
-rw-r--r-- | opcodes/ChangeLog | 14 | ||||
-rw-r--r-- | opcodes/disassemble.c | 15 | ||||
-rw-r--r-- | opcodes/sh-dis.c | 46 | ||||
-rw-r--r-- | opcodes/sh64-dis.c | 43 | ||||
-rw-r--r-- | sim/sh64/ChangeLog | 5 | ||||
-rw-r--r-- | sim/sh64/sim-if.c | 12 |
10 files changed, 56 insertions, 117 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 94a91e7..f6d1231 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +Fri May 17 14:26:19 2002 J"orn Rennecke <joern.rennecke@superh.com> + + * 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. + 2002-05-17 Corinna Vinschen <vinschen@redhat.com> * NEWS: Add section for multi-arched targets. Add v850 to that section. diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 4f5a251..55909e2 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -908,29 +908,8 @@ sh_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) static int gdb_print_insn_sh (bfd_vma memaddr, disassemble_info *info) { - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - return print_insn_sh (memaddr, info); - else - return print_insn_shl (memaddr, info); -} - -/* Disassemble an instruction. */ -static int -gdb_print_insn_sh64 (bfd_vma memaddr, disassemble_info *info) -{ - if (pc_is_isa32 (memaddr)) - { - /* Round down the instruction address to the appropriate boundary - before disassembling it. */ - return print_insn_sh64x_media (UNMAKE_ISA32_ADDR (memaddr), info); - } - else - { - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - return print_insn_sh (memaddr, info); - else - return print_insn_shl (memaddr, info); - } + info->endian = TARGET_BYTE_ORDER; + return print_insn_sh (memaddr, info); } /* Given a GDB frame, determine the address of the calling function's frame. @@ -4684,7 +4663,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) sh_store_return_value = sh64_store_return_value; skip_prologue_hard_way = sh64_skip_prologue_hard_way; do_pseudo_register = sh64_do_pseudo_register; - set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh64); set_gdbarch_register_raw_size (gdbarch, sh_sh64_register_raw_size); set_gdbarch_register_virtual_size (gdbarch, sh_sh64_register_raw_size); set_gdbarch_register_byte (gdbarch, sh_sh64_register_byte); diff --git a/include/ChangeLog b/include/ChangeLog index dd0a230..e29783e 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +Fri May 17 14:25:40 2002 J"orn Rennecke <joern.rennecke@superh.com> + + * dis-asm.h (print_insn_shl, print_insn_sh64l): Remove prototype. + 2002-04-16 David S. Miller <davem@redhat.com> * xregex2.h (__restrict_arr): Define to __restrict on GCC diff --git a/include/dis-asm.h b/include/dis-asm.h index decc863..1fc570f 100644 --- a/include/dis-asm.h +++ b/include/dis-asm.h @@ -226,7 +226,6 @@ extern int print_insn_little_powerpc PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_rs6000 PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_s390 PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_sh PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_shl PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_tic30 PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_tic54x PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_tic80 PARAMS ((bfd_vma, disassemble_info*)); @@ -235,7 +234,6 @@ extern int print_insn_vax PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_w65 PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_xstormy16 PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_sh64 PARAMS ((bfd_vma, disassemble_info *)); -extern int print_insn_sh64l PARAMS ((bfd_vma, disassemble_info *)); extern int print_insn_sh64x_media PARAMS ((bfd_vma, disassemble_info *)); extern disassembler_ftype arc_get_disassembler PARAMS ((void *)); diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 2527eeb..081fc4d 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,17 @@ +Fri May 17 14:26:44 2002 J"orn Rennecke <joern.rennecke@superh.com> + + * 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. + 2002-05-17 Alan Modra <amodra@bigpond.net.au> * acinclude.m4 (AM_INSTALL_LIBBFD): Fake to fool autotools. diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c index 93f3f00..5bfa786 100644 --- a/opcodes/disassemble.c +++ b/opcodes/disassemble.c @@ -278,20 +278,7 @@ disassembler (abfd) #endif #ifdef ARCH_sh case bfd_arch_sh: -#ifdef INCLUDE_SHMEDIA - if (bfd_get_mach (abfd) == bfd_mach_sh5) - { - if (bfd_big_endian (abfd)) - disassemble = print_insn_sh64; - else - disassemble = print_insn_sh64l; - break; - } -#endif - if (bfd_big_endian (abfd)) - disassemble = print_insn_sh; - else - disassemble = print_insn_shl; + disassemble = print_insn_sh; break; #endif #ifdef ARCH_sparc 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; -} 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; } diff --git a/sim/sh64/ChangeLog b/sim/sh64/ChangeLog index 99d5c39..706a866 100644 --- a/sim/sh64/ChangeLog +++ b/sim/sh64/ChangeLog @@ -1,3 +1,8 @@ +Fri May 17 14:27:41 2002 J"orn Rennecke <joern.rennecke@superh.com> + + * sim-if.c (sh64_disassemble_insn): Use print_insn_sh instead of + print_insn_shl. + 2001-07-05 Ben Elliston <bje@redhat.com> * Makefile.in (stamp-arch): Use $(CGEN_CPU_DIR). diff --git a/sim/sh64/sim-if.c b/sim/sh64/sim-if.c index 6024697..baef638 100644 --- a/sim/sh64/sim-if.c +++ b/sim/sh64/sim-if.c @@ -232,15 +232,5 @@ sh64_disassemble_insn (SIM_CPU *cpu, const CGEN_INSN *insn, if (sh64_h_ism_get (cpu) == ISM_MEDIA) print_insn_sh64x_media (pc, &disasm_info); else - switch (disasm_info.endian) - { - case BFD_ENDIAN_BIG: - print_insn_sh (pc, &disasm_info); - break; - case BFD_ENDIAN_LITTLE: - print_insn_shl (pc, &disasm_info); - break; - default: - abort(); - } + print_insn_sh (pc, &disasm_info); } |