2003-05-31 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / mcore-tdep.c
index 36dbbdb48a4010331fdbb65adff49abb95d547b7..ea97ec297e4bd0cd5d613bdaff1b1eec1c5efec8 100644 (file)
@@ -28,6 +28,7 @@
 #include "inferior.h"
 #include "arch-utils.h"
 #include "gdb_string.h"
+#include "disasm.h"
 
 /* Functions declared and used only in this file */
 
@@ -163,7 +164,7 @@ mcore_dump_insn (char *commnt, CORE_ADDR pc, int insn)
     {
       printf_filtered ("MCORE:  %s %08x %08x ",
                       commnt, (unsigned int) pc, (unsigned int) insn);
-      TARGET_PRINT_INSN (pc, &tm_print_insn_info);
+      gdb_print_insn (pc, gdb_stdout);
       printf_filtered ("\n");
     }
 }
@@ -682,7 +683,8 @@ mcore_frame_chain (struct frame_info * fi)
        {
          /* The "FP" was saved on the stack.  Don't forget to adjust
             the "FP" with the framesize to get a real FP. */
-         callers_addr = read_memory_integer (get_frame_saved_regs (fi)[fp], REGISTER_SIZE)
+         callers_addr = read_memory_integer (get_frame_saved_regs (fi)[fp],
+                                             DEPRECATED_REGISTER_SIZE)
            + get_frame_extra_info (dummy)->framesize;
        }
       else
@@ -766,7 +768,7 @@ mcore_find_callers_reg (struct frame_info *fi, int regnum)
                                               get_frame_base (fi), regnum);
       else if (get_frame_saved_regs (fi)[regnum] != 0)
        return read_memory_integer (get_frame_saved_regs (fi)[regnum],
-                                   REGISTER_SIZE);
+                                   DEPRECATED_REGISTER_SIZE);
     }
 
   return read_register (regnum);
@@ -813,7 +815,7 @@ mcore_pop_frame (void)
              ULONGEST value;
 
              value = read_memory_unsigned_integer (get_frame_saved_regs (fi)[rn],
-                                                   REGISTER_SIZE);
+                                                   DEPRECATED_REGISTER_SIZE);
              write_register (rn, value);
            }
        }
@@ -829,9 +831,9 @@ mcore_pop_frame (void)
 /* Setup arguments and PR for a call to the target. First six arguments
    go in FIRST_ARGREG -> LAST_ARGREG, subsequent args go on to the stack.
 
-   * Types with lengths greater than REGISTER_SIZE may not be split
-   between registers and the stack, and they must start in an even-numbered
-   register. Subsequent args will go onto the stack.
+   - Types with lengths greater than DEPRECATED_REGISTER_SIZE may not
+   be split between registers and the stack, and they must start in an
+   even-numbered register. Subsequent args will go onto the stack.
 
    * Structs may be split between registers and stack, left-aligned.
 
@@ -883,21 +885,21 @@ mcore_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
          numbered register. */
       olen = len;
 
-      if (TYPE_CODE (type) != TYPE_CODE_STRUCT && len > REGISTER_SIZE && argreg % 2)
+      if (TYPE_CODE (type) != TYPE_CODE_STRUCT && len > DEPRECATED_REGISTER_SIZE && argreg % 2)
        {
-         mcore_insn_debug (("MCORE PUSH: %d > REGISTER_SIZE: and %s is not even\n",
+         mcore_insn_debug (("MCORE PUSH: %d > DEPRECATED_REGISTER_SIZE: and %s is not even\n",
                             len, mcore_register_names[argreg]));
          argreg++;
        }
 
-      if ((argreg <= LAST_ARGREG && len <= (LAST_ARGREG - argreg + 1) * REGISTER_SIZE)
+      if ((argreg <= LAST_ARGREG && len <= (LAST_ARGREG - argreg + 1) * DEPRECATED_REGISTER_SIZE)
          || (TYPE_CODE (type) == TYPE_CODE_STRUCT))
        {
          /* Something that will fit entirely into registers (or a struct
             which may be split between registers and stack). */
          mcore_insn_debug (("MCORE PUSH: arg %d going into regs\n", argnum));
 
-         if (TYPE_CODE (type) == TYPE_CODE_STRUCT && olen < REGISTER_SIZE)
+         if (TYPE_CODE (type) == TYPE_CODE_STRUCT && olen < DEPRECATED_REGISTER_SIZE)
            {
              /* Small structs must be right aligned within the register,
                 the most significant bits are undefined. */
@@ -908,16 +910,16 @@ mcore_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
 
          while (len > 0 && argreg <= LAST_ARGREG)
            {
-             write_register (argreg, extract_unsigned_integer (val, REGISTER_SIZE));
+             write_register (argreg, extract_unsigned_integer (val, DEPRECATED_REGISTER_SIZE));
              argreg++;
-             val += REGISTER_SIZE;
-             len -= REGISTER_SIZE;
+             val += DEPRECATED_REGISTER_SIZE;
+             len -= DEPRECATED_REGISTER_SIZE;
            }
 
          /* Any remainder for the stack is noted below... */
        }
       else if (TYPE_CODE (VALUE_TYPE (args[argnum])) != TYPE_CODE_STRUCT
-              && len > REGISTER_SIZE)
+              && len > DEPRECATED_REGISTER_SIZE)
        {
          /* All subsequent args go onto the stack. */
          mcore_insn_debug (("MCORE PUSH: does not fit into regs, going onto stack\n"));
@@ -990,7 +992,7 @@ mcore_use_struct_convention (int gcc_p, struct type *type)
 CORE_ADDR
 mcore_extract_struct_value_address (char *regbuf)
 {
-  return extract_address (regbuf + REGISTER_BYTE (FIRST_ARGREG), REGISTER_SIZE);
+  return extract_address (regbuf + REGISTER_BYTE (FIRST_ARGREG), DEPRECATED_REGISTER_SIZE);
 }
 
 /* Given a function which returns a value of type TYPE, extract the
@@ -1028,7 +1030,7 @@ mcore_store_return_value (struct type *type, char *valbuf)
   value_size = TYPE_LENGTH (type);
 
   /* Return value fits into registers. */
-  return_size = (value_size + REGISTER_SIZE - 1) & ~(REGISTER_SIZE - 1);
+  return_size = (value_size + DEPRECATED_REGISTER_SIZE - 1) & ~(DEPRECATED_REGISTER_SIZE - 1);
   offset = REGISTER_BYTE (RETVAL_REGNUM) + (return_size - value_size);
   zeros = alloca (return_size);
   memset (zeros, 0, return_size);
@@ -1058,8 +1060,8 @@ mcore_init_extra_frame_info (int fromleaf, struct frame_info *fi)
   if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi),
                                   get_frame_base (fi)))
     {
-      /* We need to setup fi->frame here because run_stack_dummy gets it wrong
-         by assuming it's always FP.  */
+      /* We need to setup fi->frame here because call_function_by_hand
+         gets it wrong by assuming it's always FP.  */
       deprecated_update_frame_base_hack (fi, deprecated_read_register_dummy (get_frame_pc (fi), get_frame_base (fi), SP_REGNUM));
     }
   else
@@ -1100,7 +1102,7 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Registers: */
 
   /* All registers are 32 bits */
-  set_gdbarch_register_size (gdbarch, MCORE_REG_SIZE);
+  set_gdbarch_deprecated_register_size (gdbarch, MCORE_REG_SIZE);
   set_gdbarch_deprecated_max_register_raw_size (gdbarch, MCORE_REG_SIZE);
   set_gdbarch_deprecated_max_register_virtual_size (gdbarch, MCORE_REG_SIZE);
   set_gdbarch_register_name (gdbarch, mcore_register_name);
@@ -1108,42 +1110,34 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_virtual_size (gdbarch, mcore_register_size);
   set_gdbarch_register_raw_size (gdbarch, mcore_register_size);
   set_gdbarch_register_byte (gdbarch, mcore_register_byte);
-  set_gdbarch_register_bytes (gdbarch, MCORE_REG_SIZE * MCORE_NUM_REGS);
+  set_gdbarch_deprecated_register_bytes (gdbarch, MCORE_REG_SIZE * MCORE_NUM_REGS);
   set_gdbarch_num_regs (gdbarch, MCORE_NUM_REGS);
   set_gdbarch_pc_regnum (gdbarch, 64);
   set_gdbarch_sp_regnum (gdbarch, 0);
-  set_gdbarch_fp_regnum (gdbarch, 0);
+  set_gdbarch_deprecated_fp_regnum (gdbarch, 0);
 
   /* Call Dummies:  */
 
-  set_gdbarch_call_dummy_p (gdbarch, 1);
-  set_gdbarch_call_dummy_words (gdbarch, call_dummy_words);
-  set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
-  set_gdbarch_call_dummy_start_offset (gdbarch, 0);
-  set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
-  set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
-  set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
-  set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
+  set_gdbarch_deprecated_call_dummy_words (gdbarch, call_dummy_words);
+  set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, 0);
   set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
-  set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
-  set_gdbarch_saved_pc_after_call (gdbarch, mcore_saved_pc_after_call);
+  set_gdbarch_deprecated_saved_pc_after_call (gdbarch, mcore_saved_pc_after_call);
   set_gdbarch_function_start_offset (gdbarch, 0);
   set_gdbarch_decr_pc_after_break (gdbarch, 0);
   set_gdbarch_breakpoint_from_pc (gdbarch, mcore_breakpoint_from_pc);
-  set_gdbarch_push_return_address (gdbarch, mcore_push_return_address);
-  set_gdbarch_push_arguments (gdbarch, mcore_push_arguments);
-  set_gdbarch_call_dummy_length (gdbarch, 0);
+  set_gdbarch_deprecated_push_return_address (gdbarch, mcore_push_return_address);
+  set_gdbarch_deprecated_push_arguments (gdbarch, mcore_push_arguments);
 
   /* Frames:  */
 
   set_gdbarch_deprecated_init_extra_frame_info (gdbarch, mcore_init_extra_frame_info);
-  set_gdbarch_frame_chain (gdbarch, mcore_frame_chain);
+  set_gdbarch_deprecated_frame_chain (gdbarch, mcore_frame_chain);
   set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mcore_frame_init_saved_regs);
   set_gdbarch_deprecated_frame_saved_pc (gdbarch, mcore_frame_saved_pc);
   set_gdbarch_deprecated_store_return_value (gdbarch, mcore_store_return_value);
   set_gdbarch_deprecated_extract_return_value (gdbarch, 
                                               mcore_extract_return_value);
-  set_gdbarch_store_struct_return (gdbarch, mcore_store_struct_return);
+  set_gdbarch_deprecated_store_struct_return (gdbarch, mcore_store_struct_return);
   set_gdbarch_deprecated_extract_struct_value_address (gdbarch, 
                                                       mcore_extract_struct_value_address);
   set_gdbarch_skip_prologue (gdbarch, mcore_skip_prologue);
@@ -1164,6 +1158,9 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      between registers and stack.  */
   set_gdbarch_reg_struct_has_addr (gdbarch, mcore_reg_struct_has_addr);
 
+  /* Should be using push_dummy_call.  */
+  set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
   return gdbarch;
 }
 
@@ -1178,7 +1175,7 @@ _initialize_mcore_tdep (void)
 {
   extern int print_insn_mcore (bfd_vma, disassemble_info *);
   gdbarch_register (bfd_arch_mcore, mcore_gdbarch_init, mcore_dump_tdep);
-  tm_print_insn = print_insn_mcore;
+  deprecated_tm_print_insn = print_insn_mcore;
 
 #ifdef MCORE_DEBUG
   add_show_from_set (add_set_cmd ("mcoredebug", no_class,
This page took 0.02861 seconds and 4 git commands to generate.