Preliminary cleanup for splitting host/native/target.
[deliverable/binutils-gdb.git] / gdb / tm-m88k.h
index 1890d6ca672ad0a51f8bd5e0cd1d4d28f06799bc..7ab1ead998a52942d4b901e65516e03d3c7215df 100644 (file)
-/* Copyright (C) 1986, 1987, 1988, 1989, 1990 Free Software Foundation, Inc.
+/* Target machine description for generic Motorola 88000, for GDB.
+   Copyright 1986, 1987, 1988, 1989, 1990, 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.  */
 
-/* This is currently for a 88000 running DGUX.  If other 88k ports are
-   done, OS-specific stuff should be moved (see tm-68k.h, for example).  */
 /* g++ support is not yet included.  */
 
-#include "tdesc.h"
-
 #define TARGET_BYTE_ORDER BIG_ENDIAN
 
-/* This is not a CREATE_INFERIOR_HOOK because it also applies to
-   remote debugging.  */
-#define START_INFERIOR_HOOK () \
-  { \
-    extern int safe_to_init_tdesc_context; \
-    extern int tdesc_handle; \
- \
-    safe_to_init_tdesc_context = 0; \
-    if (tdesc_handle) \
-      { \
-       dc_terminate (tdesc_handle); \
-       tdesc_handle = 0; \
-      } \
-  }
-
-#define EXTRA_FRAME_INFO dc_dcontext_t frame_context;
-#define INIT_EXTRA_FRAME_INFO(fci) \
-  {                                                                     \
-    if (fci->next_frame != NULL)                                        \
-      {                                                                 \
-        /* The call to get_prev_context */                              \
-        /* will update current_context for us. */                       \
-        int stack_error = 1;                                            \
-        jmp_buf stack_jmp;                                              \
-        if (!setjmp (stack_jmp))                                        \
-          {                                                             \
-            prev->frame_context                                         \
-              = get_prev_context (next_frame->frame_context);           \
-            stack_error = 0;                                            \
-          }                                                             \
-        else                                                            \
-          {                                                             \
-            stack_error = 0;                                            \
-            next_frame->prev = 0;                                       \
-            return 0;                                                   \
-          }                                                             \
-        if (!prev->frame_context)                                       \
-          {                                                             \
-            next_frame->prev = 0;                                       \
-            return 0;                                                   \
-          }                                                             \
-      }                                                                 \
-    else                                                                \
-      {                                                                 \
-        /* We are creating an arbitrary frame */                        \
-        /* (i.e. we are in create_new_frame).  */                       \
-        extern dc_dcontext_t current_context;                           \
-                                                                        \
-        fci->frame_context = current_context;                           \
-      }                                                                 \
-  }
-
-#define INIT_FRAME_PC(fromleaf, prev) \
-  {                                                                     \
-    prev->pc = dc_location (prev->frame_context);                       \
-    prev->frame = get_frame_base (prev->pc);                            \
-  }
+/* We cache information about saved registers in the frame structure,
+   to save us from having to re-scan function prologues every time
+   a register in a non-current frame is accessed.  */
 
-#define IEEE_FLOAT
+#define EXTRA_FRAME_INFO       \
+       struct frame_saved_regs *fsr;   \
+       CORE_ADDR locals_pointer;       \
+       CORE_ADDR args_pointer;
 
-/* Text Description (TDESC) is used by m88k to maintain stack & reg info */
+/* Zero the frame_saved_regs pointer when the frame is initialized,
+   so that FRAME_FIND_SAVED_REGS () will know to allocate and
+   initialize a frame_saved_regs struct the first time it is called.
+   Set the arg_pointer to -1, which is not valid; 0 and other values
+   indicate real, cached values.  */
 
-#define TDESC
+#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \
+       init_extra_frame_info (fromleaf, fi)
+extern void init_extra_frame_info ();
+
+#define IEEE_FLOAT
 
 /* Define this if the C compiler puts an underscore at the front
    of external names before giving them to the linker.  */
 
 #define NAMES_HAVE_UNDERSCORE
 
-/* Hook for read_relative_register_raw_bytes */
-
-#define READ_RELATIVE_REGISTER_RAW_BYTES
-
 /* Offset from address of function to start of its code.
    Zero on most machines.  */
 
@@ -105,7 +55,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 /* Advance PC across any function entry prologue instructions
    to reach some "real" code.  */
 
-#define SKIP_PROLOGUE(frompc)   0
+#define SKIP_PROLOGUE(frompc)   \
+       skip_prologue (frompc)
+extern CORE_ADDR skip_prologue ();
 
 /* The m88k kernel aligns all instructions on 4-byte boundaries.  The
    kernel also uses the least significant two bits for its own hocus
@@ -123,27 +75,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
    some instructions.  */
 
 #define SAVED_PC_AFTER_CALL(frame) \
-  (read_register (SRP_REGNUM) & (~3))
-
-/* Address of end of stack space.  */
-
-#define STACK_END_ADDR 0xF0000000
-
-/* Stack grows downward.  */
-
-#define INNER_THAN <
-
-/* Sequence of bytes for breakpoint instruction.  */
-
-/* instruction 0xF000D1FF is 'tb0 0,r0,511'
-   If Bit bit 0 of r0 is clear (always true),
-   initiate exception processing (trap).
- */
-#define BREAKPOINT {0xF0, 0x00, 0xD1, 0xFF}
-
-/* Address of end of stack space.  */
-
-#define STACK_END_ADDR 0xF0000000
+  (ADDR_BITS_REMOVE (read_register (SRP_REGNUM)))
 
 /* Stack grows downward.  */
 
@@ -169,7 +101,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 2) == 0xF800)
 
 /* Return 1 if P points to an invalid floating point value.
-   LEN is the length in bytes -- not relevant on the 386.  */
+   LEN is the length in bytes.  */
 
 #define INVALID_FLOAT(p, len) IEEE_isNAN(p,len)
 
@@ -248,7 +180,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
        "fpit",\
        "fpsr",\
        "fpcr",\
-       };
+       }
 
 
 /* Register numbers of various important registers.
@@ -261,7 +193,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define SRP_REGNUM 1           /* Contains subroutine return pointer */
 #define RV_REGNUM 2            /* Contains simple return values */
 #define SRA_REGNUM 12          /* Contains address of struct return values */
-#define FP_REGNUM 30           /* Contains address of executing stack frame */
+#define FP_REGNUM 31           /* Reg fetched to locate frame when pgm stops */
 #define SP_REGNUM 31           /* Contains address of top of stack */
 #define SXIP_REGNUM 35         /* Contains Shadow Execute Instruction Pointer */
 #define SNIP_REGNUM 36         /* Contains Shadow Next Instruction Pointer */
@@ -304,34 +236,34 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #define SHIFT_INST_REGS
 
+/* Number of bytes of storage in the actual machine representation
+   for register N.  */
+
+#define REGISTER_RAW_SIZE(N) 4
+
 /* Total amount of space needed to store our copies of the machine's
    register state, the array `registers'.  */
 
-#define REGISTER_BYTES (NUM_REGS * sizeof(REGISTER_TYPE))
+#define REGISTER_BYTES (NUM_REGS * REGISTER_RAW_SIZE(0))
 
 /* Index within `registers' of the first byte of the space for
    register N.  */
 
-#define REGISTER_BYTE(N) ((N)*sizeof(REGISTER_TYPE))
-
-/* Number of bytes of storage in the actual machine representation
-   for register N.  */
-
-#define REGISTER_RAW_SIZE(N) (sizeof(REGISTER_TYPE))
+#define REGISTER_BYTE(N) ((N)*REGISTER_RAW_SIZE(0))
 
 /* Number of bytes of storage in the program's representation
    for register N. */
 
-#define REGISTER_VIRTUAL_SIZE(N) (sizeof(REGISTER_TYPE))
+#define REGISTER_VIRTUAL_SIZE(N) (REGISTER_RAW_SIZE(N))
 
 /* Largest value REGISTER_RAW_SIZE can have.  */
 
-#define MAX_REGISTER_RAW_SIZE (sizeof(REGISTER_TYPE))
+#define MAX_REGISTER_RAW_SIZE (REGISTER_RAW_SIZE(0))
 
 /* Largest value REGISTER_VIRTUAL_SIZE can have.
 /* Are FPS1, FPS2, FPR "virtual" regisers? */
 
-#define MAX_REGISTER_VIRTUAL_SIZE (sizeof(REGISTER_TYPE))
+#define MAX_REGISTER_VIRTUAL_SIZE (REGISTER_RAW_SIZE(0))
 
 /* Nonzero if register N requires conversion
    from raw format to virtual format.  */
@@ -341,12 +273,14 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 /* Convert data from raw format for register REGNUM
    to virtual format for register REGNUM.  */
 
-#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) {bcopy ((FROM), (TO), (sizeof(REGISTER_TYPE)));}
+#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
+  {bcopy ((FROM), (TO), REGISTER_RAW_SIZE (REGNUM));}
 
 /* Convert data from virtual format for register REGNUM
    to raw format for register REGNUM.  */
 
-#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) {bcopy ((FROM), (TO), (sizeof(REGISTER_TYPE)));}
+#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO)
+  {bcopy ((FROM), (TO), REGISTER_RAW_SIZE (REGNUM));}
 
 /* Return the GDB type object for the "standard" data type
    of data in register N.  */
@@ -357,7 +291,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
    into consecutive registers starting from r2.  */
 
 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
-  bcopy (&(((void *)REGBUF)[REGISTER_BYTE(RV_REGNUM)]), (VALBUF), TYPE_LENGTH (TYPE))
+  bcopy (&(((char *)REGBUF)[REGISTER_BYTE(RV_REGNUM)]), (VALBUF), TYPE_LENGTH (TYPE))
 
 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF))
 
@@ -365,7 +299,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
    of type TYPE, given in virtual format.  */
 
 #define STORE_RETURN_VALUE(TYPE,VALBUF) \
-  write_register_bytes (2*sizeof(void*), (VALBUF), TYPE_LENGTH (TYPE))
+  write_register_bytes (2*REGISTER_RAW_SIZE(0), (VALBUF), TYPE_LENGTH (TYPE))
 
 /* In COFF, if PCC says a parameter is a short or a char, do not
    change it to int (it seems the convention is to change it). */
@@ -378,29 +312,35 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 /* FRAME_CHAIN takes a frame's nominal address
    and produces the frame's chain-pointer.
 
-   FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address
-   and produces the nominal address of the caller frame.
-
    However, if FRAME_CHAIN_VALID returns zero,
-   it means the given frame is the outermost one and has no caller.
-   In that case, FRAME_CHAIN_COMBINE is not used.  */
+   it means the given frame is the outermost one and has no caller.  */
 
-/* These are just dummies for the 88k because INIT_FRAME_PC sets prev->frame
-   instead.  */
+extern CORE_ADDR frame_chain ();
+extern int frame_chain_valid ();
+extern int frameless_function_invocation ();
 
-#define FRAME_CHAIN(thisframe) (0)
+#define FRAME_CHAIN(thisframe) \
+       frame_chain (thisframe)
 
-#define FRAME_CHAIN_VALID(chain, thisframe) (1)
+#define FRAME_CHAIN_VALID(chain, thisframe)    \
+       frame_chain_valid (chain, thisframe)
 
-#define FRAME_CHAIN_COMBINE(chain, thisframe) (0)
+#define        FRAMELESS_FUNCTION_INVOCATION(frame, fromleaf)  \
+       fromleaf = frameless_function_invocation (frame)
 
 /* Define other aspects of the stack frame.  */
 
-#define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame+4, 4))
+#define FRAME_SAVED_PC(FRAME)  \
+       frame_saved_pc (FRAME)
+extern CORE_ADDR frame_saved_pc ();
 
-#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
+#define FRAME_ARGS_ADDRESS(fi) \
+       frame_args_address (fi)
+extern CORE_ADDR frame_args_address ();
 
-#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
+#define FRAME_LOCALS_ADDRESS(fi) \
+       frame_locals_address (fi)
+extern CORE_ADDR frame_locals_address ();
 
 /* Return number of args passed to a frame.
    Can return -1, meaning no way to tell.  */
@@ -448,13 +388,15 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
         frame_find_saved_regs (frame_info, &frame_saved_regs)
 
 \f
+/* There is not currently a functioning way to call functions in the
+   inferior.  */
+
+/* But if there was this is where we'd put the call dummy.  */
+/* #define CALL_DUMMY_LOCATION AFTER_TEXT_END */
+
 /* When popping a frame on the 88k (say when doing a return command), the
    calling function only expects to have the "preserved" registers restored.
    Thus, those are the only ones that we even try to restore here.   */
 
-extern void pop_frame ();
-
 #define POP_FRAME pop_frame ()
-
-/* BCS is a standard for binary compatibility.  This machine uses it.  */
-#define BCS
+extern void pop_frame ();
This page took 0.027243 seconds and 4 git commands to generate.