aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorMichael Tiemann <tiemann@cygnus>1994-11-24 20:30:11 +0000
committerMichael Tiemann <tiemann@cygnus>1994-11-24 20:30:11 +0000
commitd94aca1affb15af8374bcb002f6a52fb724c9ccd (patch)
treec82833f1008f99eb1afc251e5c506ca5418a4520 /opcodes
parent481faa25acc8ea42f8d5f5e5e37f137806616226 (diff)
downloadgdb-d94aca1affb15af8374bcb002f6a52fb724c9ccd.zip
gdb-d94aca1affb15af8374bcb002f6a52fb724c9ccd.tar.gz
gdb-d94aca1affb15af8374bcb002f6a52fb724c9ccd.tar.bz2
Safely check in r16 targets for binutils.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/.Sanitize8
-rw-r--r--opcodes/configure.in171
-rw-r--r--opcodes/r16-dis.c49
-rw-r--r--opcodes/r16-opc.h118
4 files changed, 300 insertions, 46 deletions
diff --git a/opcodes/.Sanitize b/opcodes/.Sanitize
index 57e5aba..83c73b4 100644
--- a/opcodes/.Sanitize
+++ b/opcodes/.Sanitize
@@ -23,6 +23,14 @@ else
lose_these_too="${mpw_files} ${lose_these_too}"
fi
+r16_files="r16-dis.c r16-opc.h"
+
+if ( echo $* | grep keep\-r16 > /dev/null ) ; then
+ keep_these_too="${r16_files} ${keep_these_too}"
+else
+ lose_these_too="${r16_files} ${lose_these_too}"
+fi
+
# All files listed between the "Things-to-keep:" line and the
# "Files-to-sed:" line will be kept. All other files will be removed.
# Directories listed in this section will have their own Sanitize
diff --git a/opcodes/configure.in b/opcodes/configure.in
index b6487a6..8feb9df 100644
--- a/opcodes/configure.in
+++ b/opcodes/configure.in
@@ -8,58 +8,15 @@ srcname="opcodes"
# per-host:
-case "${host}" in
- a29k-nyu-sym1) my_host=ultra3 ;;
- hppa*-hp-bsd) my_host=hppabsd ;;
- hppa*-hp-hpux) my_host=hppahpux ;;
- i860-stratus-sysv4) my_host=stratus ;;
- i[34]86-*-go32) my_host=go32 ;;
- i[34]86-*-linux) my_host=i386linux ;;
- i[34]86-*-mach) my_host=i386mach ;;
- i[34]86-*-msdos*) my_host=dose ;;
- i[34]86-*-sysv*) my_host=i386v ;;
- i[34]86-*-sco) my_host=i386v ;;
- i[34]86-*-sysv4*) my_host=i386v4 ;;
- i[34]86-ncr-sysv4*) my_host=ncr3000 ;;
- m68k-apollo-bsd*) my_host=apollo68 ;;
- m68k-apollo-sysv*) my_host=apollov68 ;;
- m68k-cbm-amigados) my_host=amigados ;;
- m68k-cbm-sysv4*) my_host=amix ;;
- m68k-hp-bsd) my_host=hp300bsd ;;
- m68k-hp-hpux) my_host=hp300 ;; # renamed from hp9000
- m68k-sony-*) my_host=news ;;
- m68k-sun-sunos*) my_host=sun3 ;;
- m88k-dg-dgux) my_host=dgux ;;
- m88k-harris-*) my_host=harris ;;
- m88k-motorola-*) my_host=delta88 ;;
- mips-dec-ultrix) my_host=decstation ;;
- mips-sgi-irix | mips-sgi-irix3) my_host=irix3 ;;
- mips-sgi-irix4) my_host=irix4 ;;
- romp-ibm-bsd*) my_host=rtbsd ;;
- rs6000-ibm-aix) my_host=rs6000 ;;
- sparc-*-sysv4) my_host=sysv4 ;;
- sparc-*-sysv64) my_host=sysv4-ll ;;
- sparc-sun-solaris2) my_host=solaris2 ;;
- sparc-sun-sunos*) my_host=sparc ;;
- sparc-sun-sunos64) my_host=sparc-ll ;;
- tahoe-*-*) my_host=tahoe ;;
- vax-dec-bsd*) my_host=vaxbsd ;;
- vax-dec-ultrix*) my_host=vaxult ;;
- we32k-*-*) my_host=we32k ;;
-esac
-
+. ${srcdir}/../bfd/configure.host
# Set up to make a link between the host's include file and "sysdep.h".
files="../bfd/hosts/${my_host}.h"
-
links="sysdep.h"
if [ ! -f ${srcdir}/${files} ] ; then
- if [ -n "${my_host}" ] ; then
- echo '***' No file ${srcdir}/${files} 1>&2
- fi
- echo '***' ${srcname} does not support host ${host} 1>&2
- exit 1
+ files=../bfd/hosts/std-host.h
+ echo "[${srcname} has no specific support for host ${host} -- using std-host]"
fi
host_makefile_frag=
@@ -68,3 +25,125 @@ if [ -f ${srcdir}/../bfd/config/${my_host}.mh ] ; then
fi
# per-target:
+
+# Canonicalize the secondary target names.
+if [ -n "$enable_targets" ]; then
+ for targ in `echo $enable_targets | sed 's/,/ /g'`
+ do
+ result=`$configsub $targ 2>/dev/null`
+ if [ -n "$result" ]; then
+ canon_targets="$canon_targets $result"
+ else
+ # Allow targets that config.sub doesn't recognize, like "all".
+ canon_targets="$canon_targets $targ"
+ fi
+ done
+fi
+
+all_targets=false
+
+for targ in $target $canon_targets
+do
+ bfd_target=`${config_shell} $srcdir/../bfd/config.bfd $targ`
+
+ if [ "x$bfd_target" = "xall" ]; then
+ all_targets=true
+ else
+ if [ ! -f ${srcdir}/../bfd/config/${bfd_target}.mt ] ; then
+ echo '***' No file ${srcdir}/../bfd/config/${bfd_target}.mt 1>&2
+ echo '***' opcodes does not support target ${bfd_target} 1>&2
+ echo '***' Look in bfd/config.bfd for supported targets 1>&2
+ exit 1
+ fi
+
+ if [ "x$targ" = "x$target" ]; then
+ target_makefile_frag=${srcdir}/../bfd/config/${bfd_target}.mt
+ else
+ target_extra_frags="$target_extra_frags ${srcdir}/../bfd/config/${bfd_target}.mt"
+ fi
+ fi
+done
+
+# We don't do any links based on the target system, just makefile config.
+
+# post-target:
+
+rm -f Makefile.tmp Makefile.2
+mv Makefile Makefile.tmp
+
+if [ x${all_targets} = xfalse ]; then
+
+ allfrags="$target_makefile_frag $target_extra_frags"
+
+ # The architectures in all the configured targets.
+ SELECT_ARCHITECTURES=`sed -n '
+ s/SELECT_ARCHITECTURES[ ]*=[ ]*//p
+ ' $allfrags`
+
+ # Target architecture .o files.
+ ta=
+
+ for arch in $SELECT_ARCHITECTURES
+ do
+ ad=`echo $arch | sed -e s/bfd_//g -e s/_arch//g`
+ archdefs="$archdefs -DARCH_$ad"
+ case "$arch" in
+ bfd_a29k_arch) ta="$ta a29k-dis.o" ;;
+ bfd_alpha_arch) ta="$ta alpha-dis.o" ;;
+ bfd_arm_arch) ta="$ta arm-dis.o" ;;
+ bfd_h8300_arch) ta="$ta h8300-dis.o" ;;
+ bfd_h8500_arch) ta="$ta h8500-dis.o" ;;
+ bfd_hppa_arch) ta="$ta hppa-dis.o" ;;
+ bfd_i386_arch) ta="$ta i386-dis.o" ;;
+ bfd_i960_arch) ta="$ta i960-dis.o" ;;
+ bfd_m68k_arch) ta="$ta m68k-dis.o" ;;
+ bfd_m88k_arch) ta="$ta m88k-dis.o" ;;
+ bfd_mips_arch) ta="$ta mips-dis.o mips-opc.o" ;;
+ bfd_ns32k_arch) ta="$ta ns32k-dis.o" ;;
+ bfd_powerpc_arch) ta="$ta ppc-dis.o ppc-opc.o" ;;
+ bfd_rs6000_arch) ta="$ta ppc-dis.o ppc-opc.o" ;;
+ bfd_sh_arch) ta="$ta sh-dis.o" ;;
+# start-sanitize-r16
+ bfd_r16_arch) ta="$ta r16-dis.o" ;;
+# end-sanitize-r16
+ bfd_sparc_arch) ta="$ta sparc-dis.o sparc-opc.o" ;;
+ bfd_vax_arch) ;;
+ bfd_we32k_arch) ;;
+ bfd_z8k_arch) ta="$ta z8k-dis.o" ;;
+
+ "") ;;
+ *) echo "*** unknown target architecture $arch" 1>&2; exit 1 ;;
+ esac
+ done
+
+ # Weed out duplicate .o files.
+ f=""
+ for i in $ta ; do
+ case " $f " in
+ *" $i "*) ;;
+ *) f="$f $i" ;;
+ esac
+ done
+ ta="$f"
+
+ # And duplicate -D flags.
+ f=""
+ for i in $archdefs ; do
+ case " $f " in
+ *" $i "*) ;;
+ *) f="$f $i" ;;
+ esac
+ done
+ archdefs="$f"
+
+ echo "ARCHDEFS = $archdefs" >> Makefile.2
+ echo "BFD_MACHINES = $ta" >> Makefile.2
+
+else # all_targets is true
+ echo 'ARCHDEFS = -DARCH_all' >> Makefile.2
+ echo 'BFD_MACHINES = $(ALL_MACHINES)' >> Makefile.2
+fi # all_targets is true
+
+cat Makefile.tmp >> Makefile.2
+rm -f Makefile.tmp
+mv Makefile.2 Makefile
diff --git a/opcodes/r16-dis.c b/opcodes/r16-dis.c
new file mode 100644
index 0000000..cf30160
--- /dev/null
+++ b/opcodes/r16-dis.c
@@ -0,0 +1,49 @@
+/* Disassemble R16 instructions.
+ Copyright (C) 1993 Free Software Foundation, Inc.
+
+This program 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.
+
+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.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include <stdio.h>
+#define STATIC_TABLE
+#define DEFINE_TABLE
+
+#include "r16-opc.h"
+#include "dis-asm.h"
+
+int
+print_insn_sop(memaddr, info)
+ bfd_vma memaddr;
+ struct disassemble_info *info;
+{
+ fprintf_ftype fprintf = info->fprintf_func;
+ void *stream = info->stream;
+ unsigned char insn[2];
+ unsigned char nibs[4];
+ int status;
+ int relmask = ~0;
+ r16_opcode_info *op;
+ int dslot = 0;
+
+ status = info->read_memory_func(memaddr, insn, 2, info);
+
+ if (status != 0)
+ {
+ info->memory_error_func(status, memaddr, info);
+ return -1;
+ }
+ /**** DISASSEMBLY NOT YET IMPLEMENTED ****/
+ fprintf(stream,".word 0x%02x%02x", insn[0], insn[1]);
+ return 2;
+}
diff --git a/opcodes/r16-opc.h b/opcodes/r16-opc.h
new file mode 100644
index 0000000..4e29878
--- /dev/null
+++ b/opcodes/r16-opc.h
@@ -0,0 +1,118 @@
+typedef enum {
+ O0, OT, O1, OC, O2, OI, OB, LS, BR, LI, LR, LJ, OM
+} r16_opclass;
+
+typedef struct inst
+{ char *name;
+ unsigned short opclass;
+ unsigned short inst;
+} r16_opcode_info;
+
+#ifdef DEFINE_TABLE
+r16_opcode_info r16_table[]={
+{ "bkpt", O0, 0x0000 },
+{ "sync", O0, 0x0001 },
+{ "rte", O0, 0x0002 },
+{ "rfi", O0, 0x0003 },
+{ "stop", O0, 0x0004 },
+{ "wait", O0, 0x0005 },
+
+{ "trap", OT, 0x0010 },
+{ "mvc", O1, 0x0020 },
+{ "mvcv", O1, 0x0030 },
+{ "jmp", O1, 0x0040 },
+{ "jsr", O1, 0x0050 },
+{ "jmpt", O1, 0x0060 },
+{ "jmpf", O1, 0x0070 },
+{ "tsteq", O1, 0x0080 },
+{ "tstgt", O1, 0x0090 },
+{ "tstlt", O1, 0x00A0 },
+{ "tstbz", O1, 0x00B0 },
+{ "inct", O1, 0x00C0 },
+{ "incf", O1, 0x00D0 },
+{ "dect", O1, 0x00E0 },
+{ "decf", O1, 0x00F0 },
+{ "zextb", O1, 0x0100 },
+{ "sextb", O1, 0x0110 },
+{ "zexth", O1, 0x0120 },
+{ "sexth", O1, 0x0130 },
+{ "xtrb3", O1, 0x0140 },
+{ "xtrb2", O1, 0x0150 },
+{ "xtrb1", O1, 0x0160 },
+{ "xtrb0", O1, 0x0170 },
+
+{ "decgt", O1, 0x01C0 },
+{ "declt", O1, 0x01D0 },
+{ "brev", O1, 0x01E0 },
+{ "not", O1, 0x01F0 },
+{ "mfcr", OC, 0x0200 },
+{ "mtcr", OC, 0x0300 },
+{ "mov", O2, 0x0400 },
+{ "movnc", O2, 0x0600 },
+{ "tst", O2, 0x0700 },
+{ "cmpeq", O2, 0x0800 },
+{ "cmpgt", O2, 0x0900 },
+{ "cmphi", O2, 0x0A00 },
+{ "bgenr", O2, 0x0D00 },
+{ "movt", O2, 0x0E00 },
+{ "movf", O2, 0x0F00 },
+{ "and", O2, 0x1000 },
+{ "andn", O2, 0x1100 },
+{ "xor", O2, 0x1200 },
+{ "xnor", O2, 0x1300 },
+{ "or", O2, 0x1400 },
+{ "rsub", O2, 0x1500 },
+{ "addu", O2, 0x1600 },
+{ "subu", O2, 0x1700 },
+{ "ixh", O2, 0x1800 },
+{ "ixw", O2, 0x1900 },
+{ "addc", O2, 0x1A00 },
+{ "subc", O2, 0x1B00 },
+{ "lsr", O2, 0x1C00 },
+{ "asr", O2, 0x1D00 },
+{ "lsl", O2, 0x1E00 },
+{ "rotl", O2, 0x1F00 },
+{ "movi", OB, 0x2000 },
+
+{ "andi", OB, 0x2200 },
+{ "movit", OB, 0x2400 },
+{ "movif", OB, 0x2600 },
+{ "btsti", OB, 0x2800 },
+{ "bclri", OB, 0x2A00 },
+{ "bseti", OB, 0x2C00 },
+{ "bmaski", OB, 0x2E00 },
+{ "bgeni", OB, 0x3000 },
+{ "rsubi", OB, 0x3200 },
+{ "addi", OI, 0x3400 },
+{ "subi", OI, 0x3600 },
+{ "lsri", OB, 0x3800 },
+{ "lsrc", O1, 0x3800 },
+{ "asri", OB, 0x3A00 },
+{ "asrc", O1, 0x3A00 },
+{ "lsli", OB, 0x3C00 },
+{ "lslc", O1, 0x3C00 },
+{ "rotli", OB, 0x3E00 },
+{ "rotlc", O1, 0x3E00 },
+
+{ "ldm", OM, 0x6000 },
+{ "stm", OM, 0x6010 },
+{ "mult", O2, 0x6100 },
+
+{ "mvir1", LI, 0x6800 },
+{ "lrw", LR, 0x7000 },
+{ "jmpi", LJ, 0x7300 },
+{ "jsri", LJ, 0x7F00 },
+
+{ "ld", LS, 0x8000 },
+{ "st", LS, 0x9000 },
+{ "ld.b", LS, 0xA000 },
+{ "st.b", LS, 0xB000 },
+{ "ld.h", LS, 0xC000 },
+{ "st.h", LS, 0xD000 },
+{ "br", BR, 0xE000 },
+{ "bsr", BR, 0xE800 },
+{ "bt", BR, 0xF000 },
+{ "bf", BR, 0xF800 },
+{ 0, 0, 0 }
+};
+#endif