* Makefile.in: VERSION 4.2.96.
[deliverable/binutils-gdb.git] / gdb / m68k-pinsn.c
index 8d474a994756d7980e99cad51455cdd5afcae605..de43af111461bf3e3c06a5b55f53cf4a450b7936 100644 (file)
@@ -1,31 +1,28 @@
-/* Print m68k instructions for GDB, the GNU debugger.
-   Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
+/* Print Motorola 68k instructions for GDB, the GNU debugger.
+   Copyright 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
-GDB is free software; you can redistribute it and/or modify
+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 1, or (at your option)
-any later version.
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
 
-GDB is distributed in the hope that it will be useful,
+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 GDB; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
 
-#include <setjmp.h>
-#include <signal.h>
-
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
-#include "opcode.h"
+#include "m68k-opcode.h"
+#include "gdbcore.h"
 
 /* 68k instructions are never longer than this many bytes.  */
 #define MAXLEN 22
@@ -214,7 +211,9 @@ print_insn_arg (d, buffer, p, addr, stream)
 
     case 'Q':
       val = fetch_arg (buffer, place, 3);
-      if (val == 0) val = 8;
+      /* 0 means 8, except for the bkpt instruction... */
+      if (val == 0 && d[1] != 's')
+       val = 8;
       fprintf_filtered (stream, "#%d", val);
       break;
 
@@ -306,9 +305,11 @@ print_insn_arg (d, buffer, p, addr, stream)
     case 'B':
       if (place == 'b')
        val = NEXTBYTE (p);
-      else if (place == 'w')
+      else if (place == 'B')
+       val = buffer[1];
+      else if (place == 'w' || place == 'W')
        val = NEXTWORD (p);
-      else if (place == 'l')
+      else if (place == 'l' || place == 'L')
        val = NEXTLONG (p);
       else if (place == 'g')
        {
@@ -772,119 +773,3 @@ print_base (regno, disp, stream)
   else
     fprintf_filtered (stream, "%d(%s)", disp, reg_names[regno]);
 }
-\f
-/* Nonzero if the host system has a 68881 (or compatible)
-   floating-point unit.  This does *not* indicate whether the target
-   system has a co-processor, just whether the host system does.
-   There might be a difference in the case of remote debugging.  */
-static int have_fpu = 1;
-
-/* This is not part of insn printing, but it is machine-specific,
-   so this is a convenient place to put it.
-
-   Convert a 68881 extended float to a double.
-   FROM is the address of the extended float.
-   Store the double in *TO.  */
-
-convert_from_68881 (from, to)
-     char *from;
-     double *to;
-{
-  if (!have_fpu)
-    {
-      *to = 0.0;
-      return;
-    }
-  else
-    {
-#ifdef HPUX_ASM
-      asm ("mov.l 8(%a6),%a0");
-      asm ("mov.l 12(%a6),%a1");
-      asm ("fmove.x (%a0),%fp0");
-      asm ("fmove.d %fp0,(%a1)");
-#else /* not HPUX_ASM */
-#if 0
-      asm ("movl a6@(8),a0");
-      asm ("movl a6@(12),a1");
-      asm ("fmovex a0@,fp0");
-      asm ("fmoved fp0,a1@");
-#else
-      /* Hand-assemble those insns since some assemblers lose
-        and some have different syntax.  */
-      asm (".word 020156");
-      asm (".word 8");
-      asm (".word 021156");
-      asm (".word 12");
-      asm (".long 0xf2104800");
-      asm (".long 0xf2117400");
-#endif
-#endif /* not HPUX_ASM */
-    }
-}
-
-/* The converse: convert the double *FROM to an extended float
-   and store where TO points.  */
-
-convert_to_68881 (from, to)
-     double *from;
-     char *to;
-{
-  if (!have_fpu)
-      return;
-  else
-    {
-#ifdef HPUX_ASM
-      asm ("mov.l 8(%a6),%a0");
-      asm ("mov.l 12(%a6),%a1");
-      asm ("fmove.d (%a0),%fp0");
-      asm ("fmove.x %fp0,(%a1)");
-#else /* not HPUX_ASM */
-#if 0
-      asm ("movl a6@(8),a0");
-      asm ("movl a6@(12),a1");
-      asm ("fmoved a0@,fp0");
-      asm ("fmovex fp0,a1@");
-#else
-      /* Hand-assemble those insns since some assemblers lose.  */
-      asm (".word 020156");
-      asm (".word 8");
-      asm (".word 021156");
-      asm (".word 12");
-      asm (".long 0xf2105400");
-      asm (".long 0xf2116800");
-#endif
-#endif /* not HPUX_ASM */
-    }
-}
-
-static jmp_buf fpu_check;
-
-void
-sigemt()
-{
-    have_fpu = 0;
-    longjmp (fpu_check, 1);
-}
-
-void
-_initialize_pinsn()
-{
-  /* Want to figure out if we've got a coprocessor. The idea is to catch the
-     signal that gets delivered if no coprocessor is around (SIGEMT) then
-     execute a coprocessor instruction and see what happens. have_fpu is set
-     to zero if the EMT signal arrives. Else it is left at 1.  */
-  /* If this turns out not to be portable to all 68k machines, we'll
-     have to move it to the dep files.  */
-  void (*emthandler) ();
-
-  emthandler = (void (*) ()) signal (SIGEMT, sigemt);
-  if (!setjmp (fpu_check))
-    {
-#if defined(HPUX_ASM)
-      asm (" long       0xf2000600");   /* fmovel fp0, d0 */
-#else
-      asm(".long       0xf2000600");   /* fmovel fp0, d0 */
-#endif
-    }
-  signal(SIGEMT, emthandler);
-}
This page took 0.02615 seconds and 4 git commands to generate.