2003-05-30 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / config / sparc / tm-sparc.h
index daa8141cc716da7ac7067359841761215773e94e..16f94db182c52758225a9c2af3f05d61168370fa 100644 (file)
@@ -1,7 +1,7 @@
 /* Target machine sub-parameters for SPARC, for GDB, the GNU debugger.
    This is included by other tm-*.h files to define SPARC cpu-related info.
    Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
-   1998, 1999, 2000
+   1998, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@mcc.com)
 
@@ -164,9 +164,8 @@ extern int sparc_intreg_size (void);
 
 #define FUNCTION_START_OFFSET 0
 
-/* Amount PC must be decremented by after a breakpoint.
-   This is often the number of bytes in BREAKPOINT
-   but not always.  */
+/* Amount PC must be decremented by after a breakpoint.  This is often
+   the number of bytes returned by BREAKPOINT_FROM_PC but not always.  */
 
 #define DECR_PC_AFTER_BREAK 0
 
@@ -174,7 +173,7 @@ extern int sparc_intreg_size (void);
    used in push_word and a few other places; REGISTER_RAW_SIZE is the
    real way to know how big a register is.  */
 
-#define REGISTER_SIZE 4
+#define DEPRECATED_REGISTER_SIZE 4
 
 /* Number of machine registers */
 
@@ -182,7 +181,7 @@ extern int sparc_intreg_size (void);
 
 #define        SP_REGNUM 14            /* Contains address of top of stack, \
                                   which is also the bottom of the frame.  */
-#define        FP_REGNUM 30            /* Contains address of executing stack frame */
+#define        DEPRECATED_FP_REGNUM 30         /* Contains address of executing stack frame */
 
 #define        FP0_REGNUM 32           /* Floating point register 0 */
 
@@ -199,12 +198,13 @@ extern int sparc_intreg_size (void);
    stack rather than with the other registers, and this causes hair
    and confusion in places like pop_frame.  It might be better to
    remove the ins and locals from `registers', make sure that
-   get_saved_register can get them from the stack (even in the
-   innermost frame), and make this the way to access them.  For the
-   frame pointer we would do that via TARGET_READ_FP.  On the other
-   hand, that is likely to be confusing or worse for flat frames.  */
+   frame_register() can get them from the stack (even in the innermost
+   frame), and make this the way to access them.  For the frame
+   pointer we would do that via DEPRECATED_TARGET_READ_FP.  On the
+   other hand, that is likely to be confusing or worse for flat
+   frames.  */
 
-#define REGISTER_BYTES (32*4+32*4+8*4)
+#define DEPRECATED_REGISTER_BYTES (32*4+32*4+8*4)
 
 /* Index within `registers' of the first byte of the space for
    register N.  */
@@ -227,11 +227,11 @@ extern int sparc_intreg_size (void);
 
 /* Largest value REGISTER_RAW_SIZE can have.  */
 
-#define MAX_REGISTER_RAW_SIZE 8
+#define DEPRECATED_MAX_REGISTER_RAW_SIZE 8
 
 /* Largest value REGISTER_VIRTUAL_SIZE can have.  */
 
-#define MAX_REGISTER_VIRTUAL_SIZE 8
+#define DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE 8
 
 /* Return the GDB type object for the "standard" data type
    of data in register N.  */
@@ -250,15 +250,15 @@ extern int sparc_intreg_size (void);
 /* Advance PC across any function entry prologue instructions
    to reach some "real" code.  */
 
-extern CORE_ADDR sparc_skip_prologue (CORE_ADDR, int);
-#define SKIP_PROLOGUE(PC) sparc_skip_prologue (PC, 0)
+extern CORE_ADDR sparc_skip_prologue (CORE_ADDR);
+#define SKIP_PROLOGUE(PC) sparc_skip_prologue (PC)
 
 /* Immediately after a function call, return the saved pc.
    Can't go through the frames for this because on some machines
    the new frame is not set up until the new function executes
    some instructions.  */
 
-#define SAVED_PC_AFTER_CALL(FRAME) PC_ADJUST (read_register (RP_REGNUM))
+#define DEPRECATED_SAVED_PC_AFTER_CALL(FRAME) PC_ADJUST (read_register (RP_REGNUM))
 
 /* Stack grows downward.  */
 
@@ -267,26 +267,17 @@ extern CORE_ADDR sparc_skip_prologue (CORE_ADDR, int);
 /* Write into appropriate registers a function return value of type
    TYPE, given in virtual format.  */
 
-#define STORE_RETURN_VALUE(TYPE, VALBUF) \
-     sparc_store_return_value (TYPE, VALBUF)
-extern void sparc_store_return_value (struct type *, char *);
+#define STORE_RETURN_VALUE(TYPE, REGCACHE, VALBUF) \
+     sparc32_store_return_value (TYPE, REGCACHE, VALBUF)
+extern void sparc32_store_return_value (struct type *, struct regcache *,
+                                       const void *);
 
-/* Extract from an array REGBUF containing the (raw) register state
-   the address in which a function should return its structure value,
-   as a CORE_ADDR (or an expression that can be used as one).  */
+/* Extract from REGCACHE the address in which a function should return
+   its structure value.  */
 
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
-     sparc_extract_struct_value_address (REGBUF)
-
-extern CORE_ADDR sparc_extract_struct_value_address (char *);
-
-/* If the current gcc for for this target does not produce correct
-   debugging information for float parameters, both prototyped and
-   unprototyped, then define this macro.  This forces gdb to always
-   assume that floats are passed as doubles and then converted in the
-   callee. */
-
-#define COERCE_FLOAT_TO_DOUBLE(FORMAL, ACTUAL) (1)
+#define EXTRACT_STRUCT_VALUE_ADDRESS(REGCACHE) \
+     sparc_extract_struct_value_address (REGCACHE)
+extern CORE_ADDR sparc_extract_struct_value_address (struct regcache *);
 
 /* Stack must be aligned on 64-bit boundaries when synthesizing
    function calls (128-bit for sparc64).  */
@@ -368,7 +359,8 @@ extern CORE_ADDR sparc_pc_adjust (CORE_ADDR);
 
 /* Sequence of bytes for breakpoint instruction (ta 1). */
 
-#define BREAKPOINT {0x91, 0xd0, 0x20, 0x01}
+extern const unsigned char *sparc_breakpoint_from_pc (CORE_ADDR *pc, int *len);
+#define BREAKPOINT_FROM_PC(PC,LEN) sparc_breakpoint_from_pc ((PC), (LEN))
 
 /* Register numbers of various important registers.
    Note that some of these values are "real" register numbers,
@@ -400,8 +392,8 @@ extern CORE_ADDR sparc_pc_adjust (CORE_ADDR);
 #define CANNOT_STORE_REGISTER(regno) ((regno) == G0_REGNUM)
 
 /*
- * FRAME_CHAIN and FRAME_INFO definitions, collected here for convenience.
- */
+ * DEPRECATED_FRAME_CHAIN and FRAME_INFO definitions, collected here
+ * for convenience.  */
 
 #if !defined (GDB_MULTI_ARCH) || (GDB_MULTI_ARCH == 0)
 /*
@@ -411,58 +403,11 @@ extern CORE_ADDR sparc_pc_adjust (CORE_ADDR);
 /* Describe the pointer in each stack frame to the previous stack frame
    (its caller).  */
 
-/* FRAME_CHAIN takes a frame's nominal address
-   and produces the frame's chain-pointer. */
-
-/* In the case of the Sun 4, the frame-chain's nominal address
-   is held in the frame pointer register.
-
-   On the Sun4, the frame (in %fp) is %sp for the previous frame.
-   From the previous frame's %sp, we can find the previous frame's
-   %fp: it is in the save area just above the previous frame's %sp.
-
-   If we are setting up an arbitrary frame, we'll need to know where
-   it ends.  Hence the following.  This part of the frame cache
-   structure should be checked before it is assumed that this frame's
-   bottom is in the stack pointer.
-
-   If there isn't a frame below this one, the bottom of this frame is
-   in the stack pointer.
-
-   If there is a frame below this one, and the frame pointers are
-   identical, it's a leaf frame and the bottoms are the same also.
+/* DEPRECATED_FRAME_CHAIN takes a frame's nominal address and produces
+   the frame's chain-pointer. */
 
-   Otherwise the bottom of this frame is the top of the next frame.
-
-   The bottom field is misnamed, since it might imply that memory from
-   bottom to frame contains this frame.  That need not be true if
-   stack frames are allocated in different segments (e.g. some on a
-   stack, some on a heap in the data segment).
-
-   GCC 2.6 and later can generate ``flat register window'' code that
-   makes frames by explicitly saving those registers that need to be
-   saved.  %i7 is used as the frame pointer, and the frame is laid out
-   so that flat and non-flat calls can be intermixed freely within a
-   program.  Unfortunately for GDB, this means it must detect and
-   record the flatness of frames.
-
-   Since the prologue in a flat frame also tells us where fp and pc
-   have been stashed (the frame is of variable size, so their location
-   is not fixed), it's convenient to record them in the frame info.  */
-
-#define EXTRA_FRAME_INFO \
-  CORE_ADDR bottom;      \
-  int in_prologue;       \
-  int flat;              \
-  /* Following fields only relevant for flat frames.  */ \
-  CORE_ADDR pc_addr;     \
-  CORE_ADDR fp_addr;     \
-  /* Add this to ->frame to get the value of the stack pointer at the */ \
-  /* time of the register saves.  */ \
-  int sp_offset;
-
-/* We need to override GET_SAVED_REGISTER so that we can deal with the
-   way outs change into ins in different frames.  */
+/* We need to override DEPRECATED_GET_SAVED_REGISTER so that we can
+   deal with the way outs change into ins in different frames.  */
 
 void sparc_get_saved_register (char *raw_buffer,
                               int *optimized,
@@ -470,17 +415,17 @@ void sparc_get_saved_register (char *raw_buffer,
                               struct frame_info *frame,
                               int regnum, enum lval_type *lvalp);
 
-#define GET_SAVED_REGISTER(RAW_BUFFER, OPTIMIZED, ADDRP, FRAME, REGNUM, LVAL) \
+#define DEPRECATED_GET_SAVED_REGISTER(RAW_BUFFER, OPTIMIZED, ADDRP, FRAME, REGNUM, LVAL) \
      sparc_get_saved_register (RAW_BUFFER, OPTIMIZED, ADDRP, \
                               FRAME, REGNUM, LVAL)
 
-#define FRAME_INIT_SAVED_REGS(FP)      /*no-op */
+#define DEPRECATED_FRAME_INIT_SAVED_REGS(FP)   /*no-op */
 
-#define INIT_EXTRA_FRAME_INFO(FROMLEAF, FCI) \
+#define DEPRECATED_INIT_EXTRA_FRAME_INFO(FROMLEAF, FCI) \
      sparc_init_extra_frame_info (FROMLEAF, FCI)
 extern void sparc_init_extra_frame_info (int, struct frame_info *);
 
-#define FRAME_CHAIN(THISFRAME) (sparc_frame_chain (THISFRAME))
+#define DEPRECATED_FRAME_CHAIN(THISFRAME) (sparc_frame_chain (THISFRAME))
 extern CORE_ADDR sparc_frame_chain (struct frame_info *);
 
 /* A macro that tells us whether the function invocation represented
@@ -492,13 +437,13 @@ extern CORE_ADDR sparc_frame_chain (struct frame_info *);
 
 /* Where is the PC for a specific frame */
 
-#define FRAME_SAVED_PC(FRAME) sparc_frame_saved_pc (FRAME)
+#define DEPRECATED_FRAME_SAVED_PC(FRAME) sparc_frame_saved_pc (FRAME)
 extern CORE_ADDR sparc_frame_saved_pc (struct frame_info *);
 
 /* If the argument is on the stack, it will be here.  */
-#define FRAME_ARGS_ADDRESS(FI) ((FI)->frame)
+#define FRAME_ARGS_ADDRESS(FI) (get_frame_base (FI))
 
-#define FRAME_LOCALS_ADDRESS(FI) ((FI)->frame)
+#define FRAME_LOCALS_ADDRESS(FI) (get_frame_base (FI))
 
 /* Set VAL to the number of args passed to frame described by FI.
    Can set VAL to -1, meaning no way to tell.  */
@@ -517,12 +462,17 @@ extern CORE_ADDR sparc_frame_saved_pc (struct frame_info *);
      sparc_print_extra_frame_info (FI)
 extern void sparc_print_extra_frame_info (struct frame_info *);
 
-/* INIT_EXTRA_FRAME_INFO needs the PC to detect flat frames.  */
+/* DEPRECATED_INIT_EXTRA_FRAME_INFO needs the PC to detect flat
+   frames.  */
 
-#define        INIT_FRAME_PC(FROMLEAF, PREV)   /* nothing */
-#define INIT_FRAME_PC_FIRST(FROMLEAF, PREV) \
-  (PREV)->pc = ((FROMLEAF) ? SAVED_PC_AFTER_CALL ((PREV)->next) : \
-             (PREV)->next ? FRAME_SAVED_PC ((PREV)->next) : read_pc ());
+/* NOTE: cagney/2002-12-08: Add local declaration of
+   init_frame_pc_noop() because it isn't possible to include
+   "arch-utils.h" here.  */
+extern CORE_ADDR init_frame_pc_noop (int fromleaf, struct frame_info *prev);
+#define        DEPRECATED_INIT_FRAME_PC(FROMLEAF, PREV)        (init_frame_pc_noop (FROMLEAF, PREV))
+#define DEPRECATED_INIT_FRAME_PC_FIRST(FROMLEAF, PREV) \
+  ((FROMLEAF) ? DEPRECATED_SAVED_PC_AFTER_CALL ((PREV)->next) : \
+             (PREV)->next ? DEPRECATED_FRAME_SAVED_PC ((PREV)->next) : read_pc ())
 
 /* Define other aspects of the stack frame.  */
 
@@ -534,7 +484,7 @@ extern void sparc_print_extra_frame_info (struct frame_info *);
 #define        FRAME_SAVED_L0  0
 #define        FRAME_SAVED_I0  (8 * REGISTER_RAW_SIZE (L0_REGNUM))
 
-#define FRAME_STRUCT_ARGS_ADDRESS(FI) ((FI)->frame)
+#define FRAME_STRUCT_ARGS_ADDRESS(FI) (get_frame_base (FI))
 
 /* Things needed for making the inferior call functions.  */
 /*
@@ -586,18 +536,18 @@ extern void sparc_print_extra_frame_info (struct frame_info *);
  *   I understand everything in this picture except what the space
  * between fp - 0xe0 and fp - 0x140 is used for.  Oh, and I don't
  * understand why there's a large chunk of CALL_DUMMY that never gets
- * executed (its function is superceeded by PUSH_DUMMY_FRAME; they
- * are designed to do the same thing).
+ * executed (its function is superceeded by
+ * DEPRECATED_PUSH_DUMMY_FRAME; they are designed to do the same
+ * thing).
  *
- *   PUSH_DUMMY_FRAME saves the registers above sp' and pushes the
- * register file stack down one.
+ *   DEPRECATED_PUSH_DUMMY_FRAME saves the registers above sp' and
+ * pushes the * register file stack down one.
  *
  *   call_function then writes CALL_DUMMY, pushes the args onto the
  * stack, and adjusts the stack pointer.
- *
- *   run_stack_dummy then starts execution (in the middle of
- * CALL_DUMMY, as directed by call_function).
- */
+   call_function_by_hand then starts execution (in the middle of
+   CALL_DUMMY, as directed by call_function).  */
 
 #ifndef CALL_DUMMY
 /* This sequence of words is the instructions
@@ -638,21 +588,21 @@ extern void sparc_print_extra_frame_info (struct frame_info *);
 
 /* Size of the call dummy in bytes. */
 
-#define CALL_DUMMY_LENGTH 0x38
+#define DEPRECATED_CALL_DUMMY_LENGTH 0x38
 
 /* Offset within call dummy of first instruction to execute. */
 
-#define CALL_DUMMY_START_OFFSET 0
+#define DEPRECATED_CALL_DUMMY_START_OFFSET 0
 
 /* Offset within CALL_DUMMY of the 'call' instruction. */
 
-#define CALL_DUMMY_CALL_OFFSET (CALL_DUMMY_START_OFFSET + 0x24)
+#define CALL_DUMMY_CALL_OFFSET (DEPRECATED_CALL_DUMMY_START_OFFSET + 0x24)
 
 /* Offset within CALL_DUMMY of the 'ta 1' trap instruction. */
 
-#define CALL_DUMMY_BREAKPOINT_OFFSET (CALL_DUMMY_START_OFFSET + 0x30)
+#define DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET (DEPRECATED_CALL_DUMMY_START_OFFSET + 0x30)
 
-#define CALL_DUMMY_STACK_ADJUST 68
+#define DEPRECATED_CALL_DUMMY_STACK_ADJUST 68
 
 /* Call dummy method (eg. on stack, at entry point, etc.) */
 
@@ -660,8 +610,8 @@ extern void sparc_print_extra_frame_info (struct frame_info *);
 
 /* Method for detecting dummy frames.  */
 
-#define PC_IN_CALL_DUMMY(PC, SP, FRAME_ADDRESS) \
-     pc_in_call_dummy_on_stack (PC, SP, FRAME_ADDRESS)
+#define DEPRECATED_PC_IN_CALL_DUMMY(PC, SP, FRAME_ADDRESS) \
+     deprecated_pc_in_call_dummy_on_stack (PC, SP, FRAME_ADDRESS)
 
 #endif /* GDB_MULTI_ARCH */
 
@@ -675,7 +625,7 @@ extern void sparc_print_extra_frame_info (struct frame_info *);
 /* Insert the specified number of args and function address
    into a call sequence of the above form stored at DUMMYNAME.  */
 
-#define FIX_CALL_DUMMY(DUMMYNAME, PC, FUN, NARGS, ARGS, TYPE, GCC_P) \
+#define DEPRECATED_FIX_CALL_DUMMY(DUMMYNAME, PC, FUN, NARGS, ARGS, TYPE, GCC_P) \
      sparc_fix_call_dummy (DUMMYNAME, PC, FUN, TYPE, GCC_P)
 void sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
                           struct type *value_type, int using_gcc);
@@ -685,17 +635,17 @@ void sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
 
 /* Push an empty stack frame, to record the current PC, etc.  */
 
-#define PUSH_DUMMY_FRAME       sparc_push_dummy_frame ()
-#define POP_FRAME              sparc_pop_frame ()
+#define DEPRECATED_PUSH_DUMMY_FRAME    sparc_push_dummy_frame ()
+#define DEPRECATED_POP_FRAME           sparc_pop_frame ()
 
 void sparc_push_dummy_frame (void);
 void sparc_pop_frame (void);
 
-#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
+#define DEPRECATED_PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
      sparc32_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR)
 
-extern CORE_ADDR
-sparc32_push_arguments (int, struct value **, CORE_ADDR, int, CORE_ADDR);
+extern CORE_ADDR sparc32_push_arguments (int, struct value **, CORE_ADDR, int,
+                                        CORE_ADDR);
 
 /* Store the address of the place in which to copy the structure the
    subroutine will return.  This is called from call_function_by_hand. 
@@ -717,9 +667,10 @@ sparc32_push_arguments (int, struct value **, CORE_ADDR, int, CORE_ADDR);
    function return value of type TYPE, and copy that, in virtual
    format, into VALBUF.  */
 
-#define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
-     sparc32_extract_return_value (TYPE, REGBUF, VALBUF)
-extern void sparc32_extract_return_value (struct type *, char[], char *);
+#define EXTRACT_RETURN_VALUE(TYPE, REGCACHE, VALBUF) \
+     sparc32_extract_return_value (TYPE, REGCACHE, VALBUF)
+extern void sparc32_extract_return_value (struct type *, struct regcache *,
+                                         void *valbuf);
 
 #endif /* GDB_MULTI_ARCH */
 
@@ -736,14 +687,9 @@ extern void sparc_software_single_step (enum target_signal, int);
 #define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv)
 extern struct frame_info *setup_arbitrary_frame (int, CORE_ADDR *);
 
-/* To print every pair of float registers as a double, we use this hook.
-   We also print the condition code registers in a readable format
-   (FIXME: can expand this to all control regs).  */
-
-#undef         PRINT_REGISTER_HOOK
-#define        PRINT_REGISTER_HOOK(regno)      \
-  sparc_print_register_hook (regno)
-extern void sparc_print_register_hook (int regno);
+extern void sparc_do_registers_info (int regnum, int all);
+#undef DEPRECATED_DO_REGISTERS_INFO
+#define DEPRECATED_DO_REGISTERS_INFO(REGNUM,ALL) sparc_do_registers_info (REGNUM, ALL)
 
 /* Optimization for storing registers to the inferior.  The hook
    DO_DEFERRED_STORES
@@ -764,3 +710,4 @@ extern int deferred_stores;
 
 #define TM_PRINT_INSN_MACH bfd_mach_sparc
 
+#define DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED 1
This page took 0.03046 seconds and 4 git commands to generate.