]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/config/arc/tm-arc.h
2001-03-06 J.T. Conklin <jtc@redback.com>
[thirdparty/binutils-gdb.git] / gdb / config / arc / tm-arc.h
index c6cfb716a4a3df053aed34341e1a96843487c7ee..030c5e5b33ead76af071fc9d47d1ad5ac03a6641 100644 (file)
@@ -1,22 +1,23 @@
 /* Parameters for target machine ARC, for GDB, the GNU debugger.
-   Copyright (C) 1995 Free Software Foundation, Inc.
+   Copyright 1995, 1996, 1998, 1999, 2000 Free Software Foundation, Inc.
    Contributed by Cygnus Support.
 
-This file is part of GDB.
+   This file is part of GDB.
 
-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 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.
+   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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   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., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 /* Used by arc-tdep.c to set the default cpu type.  */
 #define DEFAULT_ARC_CPU_TYPE "base"
@@ -25,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #define        TARGET_BYTE_ORDER_SELECTABLE
 
 /* We have IEEE floating point, if we have any float at all.  */
-#define IEEE_FLOAT
+#define IEEE_FLOAT (1)
 
 /* Offset from address of function to start of its code.
    Zero on most machines.  */
@@ -37,11 +38,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    knows that the function has a frame.  Its result is equal
    to its input PC if the function is frameless, unequal otherwise.  */
 
-#define SKIP_PROLOGUE(pc) \
-  { pc = skip_prologue (pc, 0); }
-#define SKIP_PROLOGUE_FRAMELESS_P(pc) \
-  { pc = skip_prologue (pc, 1); }
-extern CORE_ADDR skip_prologue PARAMS ((CORE_ADDR, int));
+#define SKIP_PROLOGUE(pc) (arc_skip_prologue (pc, 0))
+#define SKIP_PROLOGUE_FRAMELESS_P(pc) (arc_skip_prologue (pc, 1))
+extern CORE_ADDR arc_skip_prologue (CORE_ADDR, int);
 
 /* Sequence of bytes for breakpoint instruction.
    ??? The current value is "sr -1,[-1]" and is for the simulator only.
@@ -53,13 +52,20 @@ extern CORE_ADDR skip_prologue PARAMS ((CORE_ADDR, int));
 #define BIG_BREAKPOINT { 0x12, 0x1f, 0xff, 0xff }
 #define LITTLE_BREAKPOINT { 0xff, 0xff, 0x1f, 0x12 }
 
-/* ??? This value may eventually be correct (if/when proper breakpoints
-   are added).  Until then no value is correct so leave as is and cope.  */
+/* Given the exposed pipeline, there isn't any one correct value.
+   However, this value must be 4.  GDB can't handle any other value (other than
+   zero).  See for example infrun.c:
+   "prev_pc != stop_pc - DECR_PC_AFTER_BREAK"  */
+/* FIXME */
 #define DECR_PC_AFTER_BREAK 8
 
 /* We don't have a reliable single step facility.
    ??? We do have a cycle single step facility, but that won't work.  */
-#define NO_SINGLE_STEP
+#define SOFTWARE_SINGLE_STEP_P 1
+extern void arc_software_single_step (unsigned int, int);
+#define SOFTWARE_SINGLE_STEP(sig,bp_p) arc_software_single_step (sig, bp_p)
+
+/* FIXME: Need to set STEP_SKIPS_DELAY.  */
 
 /* Given a pc value as defined by the hardware, return the real address.
    Remember that on the ARC blink contains that status register which
@@ -76,14 +82,7 @@ extern CORE_ADDR skip_prologue PARAMS ((CORE_ADDR, int));
 
 /* Stack grows upward */
 
-#define INNER_THAN <
-
-/* Nonzero if instruction at pc is a return instruction.
-   This is the "j [blink]" insn (with or without conditionals or delay
-   slots).  */
-
-#define ABOUT_TO_RETURN(pc) \
-  ((read_memory_integer(pc, 4) & 0xffffff80) == 0x380f8000)
+#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
 
 /* Say how long (ordinary) registers are.  This is a piece of bogosity
    used in push_word and a few other places; REGISTER_RAW_SIZE is the
@@ -118,15 +117,15 @@ extern CORE_ADDR skip_prologue PARAMS ((CORE_ADDR, int));
 /* Register numbers of various important registers (used to index
    into arrays of register names and register values).  */
 
-#define R0_REGNUM   0     /* First local register              */
-#define R59_REGNUM 59     /* Last local register               */
-#define FP_REGNUM  27     /* Contains address of executing stack frame */
-#define SP_REGNUM  28      /* stack pointer */
-#define BLINK_REGNUM 31    /* link register */
-#define        STA_REGNUM 61      /* processor status word */
-#define PC_REGNUM  91     /* instruction pointer */
-#define AUX_BEG_REGNUM  61 /* aux reg begins */
-#define AUX_END_REGNUM  90 /* aux reg ends, pc not real aux reg */
+#define R0_REGNUM   0          /* First local register           */
+#define R59_REGNUM 59          /* Last local register            */
+#define FP_REGNUM  27          /* Contains address of executing stack frame */
+#define SP_REGNUM  28          /* stack pointer */
+#define BLINK_REGNUM 31                /* link register */
+#define        STA_REGNUM 61           /* processor status word */
+#define PC_REGNUM  91          /* instruction pointer */
+#define AUX_BEG_REGNUM  61     /* aux reg begins */
+#define AUX_END_REGNUM  90     /* aux reg ends, pc not real aux reg */
 
 /* Fake registers used to mark immediate data.  */
 #define SHIMM_FLAG_REGNUM 61
@@ -160,8 +159,8 @@ extern CORE_ADDR skip_prologue PARAMS ((CORE_ADDR, int));
       0 \
     } \
 }
-   
-#define PFP_REGNUM R0_REGNUM   /* Previous frame pointer       */
+
+#define PFP_REGNUM R0_REGNUM   /* Previous frame pointer */
 
 /* Total amount of space needed to store our copies of the machine's
    register state, the array `registers'.  */
@@ -186,8 +185,8 @@ extern CORE_ADDR skip_prologue PARAMS ((CORE_ADDR, int));
 /* Return the GDB type object for the "standard" data type
    of data in register N.  */
 #define REGISTER_VIRTUAL_TYPE(N) (builtin_type_int)
-
 \f
+
 /* Macros for understanding function return values... */
 
 /* Does the specified function use the "struct returning" convention
@@ -209,7 +208,7 @@ extern CORE_ADDR skip_prologue PARAMS ((CORE_ADDR, int));
    a function return value of type TYPE, and copy that, in virtual format,
    into VALBUF.  This is only called if USE_STRUCT_CONVENTION for this
    type is 0.
-*/
+ */
 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
        memcpy(VALBUF, REGBUF+REGISTER_BYTE(R0_REGNUM), TYPE_LENGTH (TYPE))
 
@@ -230,8 +229,8 @@ extern CORE_ADDR skip_prologue PARAMS ((CORE_ADDR, int));
    subroutine will return.  This is called from call_function. */
 #define STORE_STRUCT_RETURN(ADDR, SP) \
     error ("Returning values from functions is not implemented in arc gdb")
-
 \f
+
 /* Describe the pointer in each stack frame to the previous stack frame
    (its caller).  */
 
@@ -265,26 +264,20 @@ extern CORE_ADDR skip_prologue PARAMS ((CORE_ADDR, int));
 
 /* FRAME_CHAIN_VALID returns zero if the given frame is the outermost one
    and has no caller.  */
-#define FRAME_CHAIN_VALID(chain, thisframe) ((chain) != 0)
+#define FRAME_CHAIN_VALID(chain, thisframe) nonnull_frame_chain_valid (chain, thisframe)
 
-/* A macro that tells us whether the function invocation represented
-   by FI does not have a frame on the stack associated with it.  If it
-   does not, FRAMELESS is set to 1, else 0.  */
+/* An expression that tells us whether the function invocation represented
+   by FI does not have a frame on the stack associated with it. */
 
-#define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
-  do { \
-    if ((FI)->signal_handler_caller) \
-      (FRAMELESS) = 0; \
-    else \
-      (FRAMELESS) = frameless_look_for_prologue (FI); \
-  } while (0)
+#define FRAMELESS_FUNCTION_INVOCATION(FI) \
+     (((FI)->signal_handler_caller) ? 0 : frameless_look_for_prologue (FI))
 
 /* Where is the PC for a specific frame.
    A leaf function may never save blink, so we have to check for that here.  */
 
 #define FRAME_SAVED_PC(frame) (arc_frame_saved_pc (frame))
-struct frame_info; /* in case frame.h not included yet */
-CORE_ADDR arc_frame_saved_pc PARAMS ((struct frame_info *));
+struct frame_info;             /* in case frame.h not included yet */
+CORE_ADDR arc_frame_saved_pc (struct frame_info *);
 
 /* If the argument is on the stack, it will be here.
    We cache this value in the frame info if we've already looked it up.  */
@@ -302,7 +295,7 @@ CORE_ADDR arc_frame_saved_pc PARAMS ((struct frame_info *));
 /* Set NUMARGS to the number of args passed to a frame.
    Can return -1, meaning no way to tell.  */
 
-#define FRAME_NUM_ARGS(numargs, fi)    (numargs = -1)
+#define FRAME_NUM_ARGS(fi)     (-1)
 
 /* Return number of bytes at start of arglist that are not really args.  */
 
@@ -312,26 +305,28 @@ CORE_ADDR arc_frame_saved_pc PARAMS ((struct frame_info *));
 
 #define FRAME_FIND_SAVED_REGS(frame_info_addr, sr) \
        frame_find_saved_regs (frame_info_addr, &sr)
-extern void frame_find_saved_regs();           /* See arc-tdep.c */
-
+extern void frame_find_saved_regs ();  /* See arc-tdep.c */
 \f
+
 /* Things needed for making calls to functions in the inferior process */
+void arc_push_dummy_frame (void);
 #define PUSH_DUMMY_FRAME \
-       push_dummy_frame ()
+       arc_push_dummy_frame ()
 
 /* Discard from the stack the innermost frame, restoring all registers.  */
+void arc_pop_frame (void);
 #define POP_FRAME \
-       pop_frame ()
+       arc_pop_frame ()
 
 /* This sequence of words is the instructions  bl xxxx, flag 1 */
-#define CALL_DUMMY { 0x28000000, 0x1fbe8001 }   
+#define CALL_DUMMY { 0x28000000, 0x1fbe8001 }
 #define CALL_DUMMY_LENGTH 8
 
 /* Start execution at beginning of dummy */
-#define CALL_DUMMY_START_OFFSET 0 
+#define CALL_DUMMY_START_OFFSET 0
 
 /* Insert the specified number of args and function address
-   into a call sequence of the above form stored at 'dummyname'.*/  
+   into a call sequence of the above form stored at 'dummyname'. */
 #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
 { \
         int from, to, delta, loc; \
@@ -344,4 +339,3 @@ extern void frame_find_saved_regs();                /* See arc-tdep.c */
         *((char *)(dummyname) + 3) = ((delta >> 9) & 0xff); \
         *((char *)(dummyname) + 4) = ((delta >> 17) & 0x7); \
 }
-