* sh.h (R_SH_SWITCH8, R_SH_GNU_VTINHERIT, R_SH_GNU_VTENTRY,
[binutils-gdb.git] / gdb / cris-tdep.c
index 2fbfde53b0e3477d3e227475188c28bae3b6fc0d..89f54cf2ea308cda19d5f54b6e7b8e8fdf51f058 100644 (file)
@@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "opcode/cris.h"
 #include "arch-utils.h"
 #include "regcache.h"
+#include "gdb_assert.h"
 
 /* To get entry_point_address.  */
 #include "symfile.h"
@@ -38,6 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "solib.h"              /* Support for shared libraries. */
 #include "solib-svr4.h"         /* For struct link_map_offsets.  */
 #include "gdb_string.h"
+#include "dis-asm.h"
 
 
 enum cris_num_regs
@@ -373,8 +375,6 @@ static CORE_ADDR cris_skip_prologue_main (CORE_ADDR pc, int frameless_p);
 static struct gdbarch *cris_gdbarch_init (struct gdbarch_info,
                                           struct gdbarch_list *);
 
-static int cris_delayed_get_disassembler (bfd_vma, disassemble_info *);
-
 static void cris_dump_tdep (struct gdbarch *, struct ui_file *);
 
 static void cris_version_update (char *ignore_args, int from_tty, 
@@ -464,7 +464,7 @@ static CORE_ADDR bfd_lookup_symbol (bfd *, const char *);
    the entire prologue is examined (0) or just enough instructions to 
    determine that it is a prologue (1).  */
 
-CORE_ADDR 
+static CORE_ADDR 
 cris_examine (CORE_ADDR ip, CORE_ADDR limit, struct frame_info *fi, 
               int frameless_p)
 {
@@ -712,7 +712,7 @@ cris_examine (CORE_ADDR ip, CORE_ADDR limit, struct frame_info *fi,
 /* Advance pc beyond any function entry prologue instructions at pc
    to reach some "real" code.  */
 
-CORE_ADDR
+static CORE_ADDR
 cris_skip_prologue (CORE_ADDR pc)
 {
   return cris_skip_prologue_main (pc, 0);
@@ -722,7 +722,7 @@ cris_skip_prologue (CORE_ADDR pc)
    has a frame.  Its result is equal to its input pc if the function is 
    frameless, unequal otherwise.  */
 
-CORE_ADDR
+static CORE_ADDR
 cris_skip_prologue_frameless_p (CORE_ADDR pc)
 {
   return cris_skip_prologue_main (pc, 1);
@@ -731,7 +731,7 @@ cris_skip_prologue_frameless_p (CORE_ADDR pc)
 /* Given a PC value corresponding to the start of a function, return the PC
    of the first instruction after the function prologue.  */
 
-CORE_ADDR
+static CORE_ADDR
 cris_skip_prologue_main (CORE_ADDR pc, int frameless_p)
 {
   struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
@@ -763,7 +763,7 @@ cris_skip_prologue_main (CORE_ADDR pc, int frameless_p)
    adjusts pcptr (if necessary) to point to the actual memory location where
    the breakpoint should be inserted.  */
 
-const unsigned char *
+static const unsigned char *
 cris_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
 {
   static unsigned char break_insn[] = {0x38, 0xe9};
@@ -784,7 +784,7 @@ cris_saved_pc_after_call (struct frame_info *frame)
 /* Returns 1 if spec_reg is applicable to the current gdbarch's CRIS version,
    0 otherwise.  */
 
-int
+static int
 cris_spec_reg_applicable (struct cris_spec_reg spec_reg)
 {
   int version = cris_version ();
@@ -818,7 +818,7 @@ cris_spec_reg_applicable (struct cris_spec_reg spec_reg)
 /* Returns the register size in unit byte.  Returns 0 for an unimplemented
    register, -1 for an invalid register.  */
 
-int
+static int
 cris_register_size (int regno)
 {
   int i;
@@ -857,7 +857,7 @@ cris_register_size (int regno)
 /* Nonzero if regno should not be fetched from the target.  This is the case
    for unimplemented (size 0) and non-existant registers.  */
 
-int
+static int
 cris_cannot_fetch_register (int regno)
 {
   return ((regno < 0 || regno >= NUM_REGS) 
@@ -867,7 +867,7 @@ cris_cannot_fetch_register (int regno)
 /* Nonzero if regno should not be written to the target, for various 
    reasons.  */
 
-int
+static int
 cris_cannot_store_register (int regno)
 {
   /* There are three kinds of registers we refuse to write to.
@@ -903,7 +903,7 @@ cris_cannot_store_register (int regno)
    in the saved register state.  Returns -1 for an invalid or unimplemented
    register.  */
 
-int
+static int
 cris_register_offset (int regno)
 {
   int i;
@@ -929,7 +929,7 @@ cris_register_offset (int regno)
 /* Return the GDB type (defined in gdbtypes.c) for the "standard" data type
    of data in register regno.  */
 
-struct type *
+static struct type *
 cris_register_virtual_type (int regno)
 {
   if (regno == SP_REGNUM || regno == PC_REGNUM
@@ -966,20 +966,20 @@ cris_register_virtual_type (int regno)
 
 /* In the original CRIS ABI, R10 is used to store return values.  */
 
-void
+static void
 cris_abi_original_store_return_value (struct type *type, char *valbuf)
 {
   int len = TYPE_LENGTH (type);
   
   if (len <= DEPRECATED_REGISTER_SIZE) 
-    deprecated_write_register_bytes (REGISTER_BYTE (RET_REGNUM), valbuf, len);
+    deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (RET_REGNUM), valbuf, len);
   else
     internal_error (__FILE__, __LINE__, "cris_abi_original_store_return_value: type length too large.");
 }
 
 /* In the CRIS ABI V2, R10 and R11 are used to store return values.  */
 
-void
+static void
 cris_abi_v2_store_return_value (struct type *type, char *valbuf)
 {
   int len = TYPE_LENGTH (type);
@@ -987,8 +987,8 @@ cris_abi_v2_store_return_value (struct type *type, char *valbuf)
   if (len <= 2 * DEPRECATED_REGISTER_SIZE)
     {
       /* Note that this works since R10 and R11 are consecutive registers.  */
-      deprecated_write_register_bytes (REGISTER_BYTE (RET_REGNUM), valbuf,
-                                      len);
+      deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (RET_REGNUM),
+                                      valbuf, len);
     }
   else
     internal_error (__FILE__, __LINE__, "cris_abi_v2_store_return_value: type length too large.");
@@ -997,7 +997,7 @@ cris_abi_v2_store_return_value (struct type *type, char *valbuf)
 /* Return the name of register regno as a string. Return NULL for an invalid or
    unimplemented register.  */
 
-const char *
+static const char *
 cris_register_name (int regno)
 {
   static char *cris_genreg_names[] =
@@ -1039,7 +1039,7 @@ cris_register_name (int regno)
     }
 }
 
-int
+static int
 cris_register_bytes_ok (long bytes)
 {
   return (bytes == DEPRECATED_REGISTER_BYTES);
@@ -1051,28 +1051,28 @@ cris_register_bytes_ok (long bytes)
 
 /* In the original CRIS ABI, R10 is used to return values.  */
 
-void
+static void
 cris_abi_original_extract_return_value (struct type *type, char *regbuf, 
                                         char *valbuf)
 {
   int len = TYPE_LENGTH (type);
   
   if (len <= DEPRECATED_REGISTER_SIZE)
-    memcpy (valbuf, regbuf + REGISTER_BYTE (RET_REGNUM), len);
+    memcpy (valbuf, regbuf + DEPRECATED_REGISTER_BYTE (RET_REGNUM), len);
   else
     internal_error (__FILE__, __LINE__, "cris_abi_original_extract_return_value: type length too large");
 }
 
 /* In the CRIS ABI V2, R10 and R11 are used to store return values.  */
 
-void
+static void
 cris_abi_v2_extract_return_value (struct type *type, char *regbuf, 
                                   char *valbuf)
 {
   int len = TYPE_LENGTH (type);
   
   if (len <= 2 * DEPRECATED_REGISTER_SIZE)
-    memcpy (valbuf, regbuf + REGISTER_BYTE (RET_REGNUM), len);
+    memcpy (valbuf, regbuf + DEPRECATED_REGISTER_BYTE (RET_REGNUM), len);
   else
     internal_error (__FILE__, __LINE__, "cris_abi_v2_extract_return_value: type length too large");
 }
@@ -1083,7 +1083,7 @@ cris_abi_v2_extract_return_value (struct type *type, char *regbuf,
    be stored.  R9 is call-clobbered, which means we must save it here for
    later use.  */
 
-void
+static void
 cris_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
 {
   write_register (STR_REGNUM, addr);
@@ -1094,32 +1094,19 @@ cris_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
    structure value.  It's not there in the CRIS ABI, so we must do it another
    way.  */
 
-CORE_ADDR
+static CORE_ADDR
 cris_extract_struct_value_address (char *regbuf)
 {
   return struct_return_address;
 }
 
-/* Returns 1 if a value of the given type being returned from a function 
-   must have space allocated for it on the stack.  gcc_p is true if the 
-   function being considered is known to have been compiled by GCC. 
-   In the CRIS ABI, structure return values are passed to the called 
-   function by reference in register R9 to a caller-allocated area, so
-   this is always true.  */
-
-int
-cris_use_struct_convention (int gcc_p, struct type *type)
-{
-  return 1;
-}
-
 /* Returns 1 if the given type will be passed by pointer rather than 
    directly.  */
 
 /* In the original CRIS ABI, arguments shorter than or equal to 32 bits are 
    passed by value.  */
 
-int 
+static int 
 cris_abi_original_reg_struct_has_addr (int gcc_p, struct type *type)
 { 
   return (TYPE_LENGTH (type) > 4);
@@ -1128,7 +1115,7 @@ cris_abi_original_reg_struct_has_addr (int gcc_p, struct type *type)
 /* In the CRIS ABI V2, arguments shorter than or equal to 64 bits are passed
    by value.  */
 
-int 
+static int 
 cris_abi_v2_reg_struct_has_addr (int gcc_p, struct type *type)
 { 
   return (TYPE_LENGTH (type) > 8);
@@ -1137,7 +1124,7 @@ cris_abi_v2_reg_struct_has_addr (int gcc_p, struct type *type)
 /* Returns 1 if the function invocation represented by fi does not have a 
    stack frame associated with it.  Otherwise return 0.  */
 
-int
+static int
 cris_frameless_function_invocation (struct frame_info *fi)
 {
   if ((get_frame_type (fi) == SIGTRAMP_FRAME))
@@ -1151,7 +1138,7 @@ cris_frameless_function_invocation (struct frame_info *fi)
    frame->saved_regs shall be allocated by
    DEPRECATED_FRAME_INIT_SAVED_REGS using frame_saved_regs_zalloc.  */
 
-void
+static void
 cris_frame_init_saved_regs (struct frame_info *fi)
 {
   CORE_ADDR ip;
@@ -1161,7 +1148,7 @@ cris_frame_init_saved_regs (struct frame_info *fi)
                                                          get_frame_base (fi));
   
   /* Examine the entire prologue.  */
-  register int frameless_p = 0; 
+  int frameless_p = 0; 
 
   /* Has this frame's registers already been initialized?  */
   if (get_frame_saved_regs (fi))
@@ -1198,7 +1185,7 @@ cris_frame_init_saved_regs (struct frame_info *fi)
    When the call is from get_prev_frame_info, fromleaf is determined by
    cris_frameless_function_invocation.  */
 
-void
+static void
 cris_init_extra_frame_info (int fromleaf, struct frame_info *fi)
 {
   if (get_next_frame (fi))
@@ -1252,7 +1239,7 @@ cris_init_extra_frame_info (int fromleaf, struct frame_info *fi)
 /* Return the content of the frame pointer in the present frame.  In other
    words, determine the address of the calling function's frame.  */
 
-CORE_ADDR
+static CORE_ADDR
 cris_frame_chain (struct frame_info *fi)
 {
   if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi),
@@ -1261,7 +1248,7 @@ cris_frame_chain (struct frame_info *fi)
     {
       return get_frame_base (fi);
     }
-  else if (!inside_entry_file (get_frame_pc (fi)))
+  else if (!deprecated_inside_entry_file (get_frame_pc (fi)))
     {
       return read_memory_unsigned_integer (get_frame_base (fi), 4);
     }
@@ -1273,7 +1260,7 @@ cris_frame_chain (struct frame_info *fi)
 
 /* Return the saved PC (which equals the return address) of this frame.  */
 
-CORE_ADDR
+static CORE_ADDR
 cris_frame_saved_pc (struct frame_info *fi)
 {
   return get_frame_extra_info (fi)->return_pc;
@@ -1281,7 +1268,7 @@ cris_frame_saved_pc (struct frame_info *fi)
 
 /* Setup the function arguments for calling a function in the inferior.  */
 
-CORE_ADDR 
+static CORE_ADDR 
 cris_abi_original_push_arguments (int nargs, struct value **args, 
                                   CORE_ADDR sp, int struct_return, 
                                   CORE_ADDR struct_addr)
@@ -1367,7 +1354,7 @@ cris_abi_original_push_arguments (int nargs, struct value **args,
   return sp;
 }
 
-CORE_ADDR 
+static CORE_ADDR 
 cris_abi_v2_push_arguments (int nargs, struct value **args, CORE_ADDR sp, 
                      int struct_return, CORE_ADDR struct_addr)
 {
@@ -1499,10 +1486,10 @@ cris_abi_v2_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
    by the called function unless it is a leaf-function.  Due to the BRP
    register the PC will change when continue is sent.  */
 
-CORE_ADDR
+static CORE_ADDR
 cris_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
 {
-  write_register (SRP_REGNUM, CALL_DUMMY_ADDRESS ());
+  write_register (SRP_REGNUM, entry_point_address ());
   return sp;
 }
 
@@ -1510,12 +1497,12 @@ cris_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
    was created.  Discard the innermost frame from the stack and restore 
    all saved registers.  */
 
-void 
+static void 
 cris_pop_frame (void)
 {
-  register struct frame_info *fi = get_current_frame ();
-  register int regno;
-  register int stack_offset = 0;
+  struct frame_info *fi = get_current_frame ();
+  int regno;
+  int stack_offset = 0;
   
   if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi),
                                   get_frame_base (fi),
@@ -1772,7 +1759,7 @@ find_step_target (inst_env_type *inst_env)
    digs through the opcodes in order to find all possible targets. 
    Either one ordinary target or two targets for branches may be found.  */
 
-void
+static void
 cris_software_single_step (enum target_signal ignore, int insert_breakpoints)
 {
   inst_env_type inst_env;
@@ -1816,7 +1803,7 @@ cris_software_single_step (enum target_signal ignore, int insert_breakpoints)
 
 /* Calculates the prefix value for quick offset addressing mode.  */
 
-void
+static void
 quick_mode_bdap_prefix (unsigned short inst, inst_env_type *inst_env)
 {
   /* It's invalid to be in a delay slot.  You can't have a prefix to this
@@ -1840,7 +1827,7 @@ quick_mode_bdap_prefix (unsigned short inst, inst_env_type *inst_env)
    from the size of the operation.  The PC is always kept aligned on even
    word addresses.  */
 
-void 
+static void 
 process_autoincrement (int size, unsigned short inst, inst_env_type *inst_env)
 {
   if (size == INST_BYTE_SIZE)
@@ -1871,12 +1858,13 @@ process_autoincrement (int size, unsigned short inst, inst_env_type *inst_env)
 
 /* Just a forward declaration.  */
 
-unsigned long get_data_from_address (unsigned short *inst, CORE_ADDR address);
+static unsigned long get_data_from_address (unsigned short *inst,
+                                           CORE_ADDR address);
 
 /* Calculates the prefix value for the general case of offset addressing 
    mode.  */
 
-void
+static void
 bdap_prefix (unsigned short inst, inst_env_type *inst_env)
 {
 
@@ -1912,7 +1900,7 @@ bdap_prefix (unsigned short inst, inst_env_type *inst_env)
 
 /* Calculates the prefix value for the index addressing mode.  */
 
-void
+static void
 biap_prefix (unsigned short inst, inst_env_type *inst_env)
 {
   /* It's invalid to be in a delay slot.  I can't see that it's possible to
@@ -1947,7 +1935,7 @@ biap_prefix (unsigned short inst, inst_env_type *inst_env)
 
 /* Calculates the prefix value for the double indirect addressing mode.  */
 
-void 
+static void 
 dip_prefix (unsigned short inst, inst_env_type *inst_env)
 {
 
@@ -1980,7 +1968,7 @@ dip_prefix (unsigned short inst, inst_env_type *inst_env)
 
 /* Finds the destination for a branch with 8-bits offset.  */
 
-void
+static void
 eight_bit_offset_branch_op (unsigned short inst, inst_env_type *inst_env)
 {
 
@@ -2017,7 +2005,7 @@ eight_bit_offset_branch_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Finds the destination for a branch with 16-bits offset.  */
 
-void 
+static void 
 sixteen_bit_offset_branch_op (unsigned short inst, inst_env_type *inst_env)
 {
   short offset;
@@ -2048,7 +2036,7 @@ sixteen_bit_offset_branch_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Handles the ABS instruction.  */
 
-void 
+static void 
 abs_op (unsigned short inst, inst_env_type *inst_env)
 {
 
@@ -2090,7 +2078,7 @@ abs_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Handles the ADDI instruction.  */
 
-void 
+static void 
 addi_op (unsigned short inst, inst_env_type *inst_env)
 {
   /* It's invalid to have the PC as base register.  And ADDI can't have
@@ -2109,7 +2097,7 @@ addi_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Handles the ASR instruction.  */
 
-void 
+static void 
 asr_op (unsigned short inst, inst_env_type *inst_env)
 {
   int shift_steps;
@@ -2186,7 +2174,7 @@ asr_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Handles the ASRQ instruction.  */
 
-void 
+static void 
 asrq_op (unsigned short inst, inst_env_type *inst_env)
 {
 
@@ -2233,7 +2221,7 @@ asrq_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Handles the AX, EI and SETF instruction.  */
 
-void 
+static void 
 ax_ei_setf_op (unsigned short inst, inst_env_type *inst_env)
 {
   if (inst_env->prefix_found)
@@ -2259,7 +2247,7 @@ ax_ei_setf_op (unsigned short inst, inst_env_type *inst_env)
    register.  Note that check_assign assumes that the caller has checked that
    there is a prefix to this instruction.  The mode check depends on this.  */
 
-void 
+static void 
 check_assign (unsigned short inst, inst_env_type *inst_env)
 {
   /* Check if it's an assign addressing mode.  */
@@ -2272,7 +2260,7 @@ check_assign (unsigned short inst, inst_env_type *inst_env)
 
 /* Handles the 2-operand BOUND instruction.  */
 
-void 
+static void 
 two_operand_bound_op (unsigned short inst, inst_env_type *inst_env)
 {
   /* It's invalid to have the PC as the index operand.  */
@@ -2305,7 +2293,7 @@ two_operand_bound_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Handles the 3-operand BOUND instruction.  */
 
-void 
+static void 
 three_operand_bound_op (unsigned short inst, inst_env_type *inst_env)
 {
   /* It's an error if we haven't got a prefix.  And it's also an error
@@ -2323,7 +2311,7 @@ three_operand_bound_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Clears the status flags in inst_env.  */
 
-void 
+static void 
 btst_nop_op (unsigned short inst, inst_env_type *inst_env)
 {
   /* It's an error if we have got a prefix.  */
@@ -2341,7 +2329,7 @@ btst_nop_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Clears the status flags in inst_env.  */
 
-void 
+static void 
 clearf_di_op (unsigned short inst, inst_env_type *inst_env)
 {
   /* It's an error if we have got a prefix.  */
@@ -2359,7 +2347,7 @@ clearf_di_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Handles the CLEAR instruction if it's in register mode.  */
 
-void 
+static void 
 reg_mode_clear_op (unsigned short inst, inst_env_type *inst_env)
 {
   /* Check if the target is the PC.  */
@@ -2396,7 +2384,7 @@ reg_mode_clear_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Handles the TEST instruction if it's in register mode.  */
 
-void
+static void
 reg_mode_test_op (unsigned short inst, inst_env_type *inst_env)
 {
   /* It's an error if we have got a prefix.  */
@@ -2415,7 +2403,7 @@ reg_mode_test_op (unsigned short inst, inst_env_type *inst_env)
 /* Handles the CLEAR and TEST instruction if the instruction isn't 
    in register mode.  */
 
-void 
+static void 
 none_reg_mode_clear_test_op (unsigned short inst, inst_env_type *inst_env)
 {
   /* Check if we are in a prefix mode.  */
@@ -2440,7 +2428,7 @@ none_reg_mode_clear_test_op (unsigned short inst, inst_env_type *inst_env)
 /* Checks that the PC isn't the destination register or the instructions has
    a prefix.  */
 
-void 
+static void 
 dstep_logshift_mstep_neg_not_op (unsigned short inst, inst_env_type *inst_env)
 {
   /* It's invalid to have the PC as the destination.  The instruction can't
@@ -2459,7 +2447,7 @@ dstep_logshift_mstep_neg_not_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Checks that the instruction doesn't have a prefix.  */
 
-void
+static void
 break_op (unsigned short inst, inst_env_type *inst_env)
 {
   /* The instruction can't have a prefix.  */
@@ -2478,7 +2466,7 @@ break_op (unsigned short inst, inst_env_type *inst_env)
 /* Checks that the PC isn't the destination register and that the instruction
    doesn't have a prefix.  */
 
-void
+static void
 scc_op (unsigned short inst, inst_env_type *inst_env)
 {
   /* It's invalid to have the PC as the destination.  The instruction can't
@@ -2497,7 +2485,7 @@ scc_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Handles the register mode JUMP instruction.  */
 
-void 
+static void 
 reg_mode_jump_op (unsigned short inst, inst_env_type *inst_env)
 {
   /* It's invalid to do a JUMP in a delay slot.  The mode is register, so 
@@ -2518,7 +2506,8 @@ reg_mode_jump_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Handles the JUMP instruction for all modes except register.  */
 
-void none_reg_mode_jump_op (unsigned short inst, inst_env_type *inst_env)
+static void
+none_reg_mode_jump_op (unsigned short inst, inst_env_type *inst_env)
 {
   unsigned long newpc;
   CORE_ADDR address;
@@ -2562,7 +2551,7 @@ void none_reg_mode_jump_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Handles moves to special registers (aka P-register) for all modes.  */
 
-void 
+static void 
 move_to_preg_op (unsigned short inst, inst_env_type *inst_env)
 {
   if (inst_env->prefix_found)
@@ -2617,7 +2606,7 @@ move_to_preg_op (unsigned short inst, inst_env_type *inst_env)
 /* Handles moves from special registers (aka P-register) for all modes
    except register.  */
 
-void 
+static void 
 none_reg_mode_move_from_preg_op (unsigned short inst, inst_env_type *inst_env)
 {
   if (inst_env->prefix_found)
@@ -2672,7 +2661,7 @@ none_reg_mode_move_from_preg_op (unsigned short inst, inst_env_type *inst_env)
 /* Handles moves from special registers (aka P-register) when the mode
    is register.  */
 
-void 
+static void 
 reg_mode_move_from_preg_op (unsigned short inst, inst_env_type *inst_env)
 {
   /* Register mode move from special register can't have a prefix.  */
@@ -2707,7 +2696,7 @@ reg_mode_move_from_preg_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Handles the MOVEM from memory to general register instruction.  */
 
-void 
+static void 
 move_mem_to_reg_movem_op (unsigned short inst, inst_env_type *inst_env)
 {
   if (inst_env->prefix_found)
@@ -2764,7 +2753,7 @@ move_mem_to_reg_movem_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Handles the MOVEM to memory from general register instruction.  */
 
-void 
+static void 
 move_reg_to_mem_movem_op (unsigned short inst, inst_env_type *inst_env)
 {
   if (inst_env->prefix_found)
@@ -2803,7 +2792,7 @@ move_reg_to_mem_movem_op (unsigned short inst, inst_env_type *inst_env)
 /* Handles the pop instruction to a general register. 
    POP is a assembler macro for MOVE.D [SP+], Rd.  */
 
-void 
+static void 
 reg_pop_op (unsigned short inst, inst_env_type *inst_env)
 {
   /* POP can't have a prefix.  */
@@ -2831,7 +2820,7 @@ reg_pop_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Handles moves from register to memory.  */
 
-void 
+static void 
 move_reg_to_mem_index_inc_op (unsigned short inst, inst_env_type *inst_env)
 {
   /* Check if we have a prefix.  */
@@ -2860,7 +2849,7 @@ move_reg_to_mem_index_inc_op (unsigned short inst, inst_env_type *inst_env)
 /* Handles the intructions that's not yet implemented, by setting 
    inst_env->invalid to true.  */
 
-void 
+static void 
 not_implemented_op (unsigned short inst, inst_env_type *inst_env)
 {
   inst_env->invalid = 1;
@@ -2868,7 +2857,7 @@ not_implemented_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Handles the XOR instruction.  */
 
-void 
+static void 
 xor_op (unsigned short inst, inst_env_type *inst_env)
 {
   /* XOR can't have a prefix.  */
@@ -2897,7 +2886,7 @@ xor_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Handles the MULS instruction.  */
 
-void 
+static void 
 muls_op (unsigned short inst, inst_env_type *inst_env)
 {
   /* MULS/U can't have a prefix.  */
@@ -2921,7 +2910,7 @@ muls_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Handles the MULU instruction.  */
 
-void 
+static void 
 mulu_op (unsigned short inst, inst_env_type *inst_env)
 {
   /* MULS/U can't have a prefix.  */
@@ -2946,7 +2935,7 @@ mulu_op (unsigned short inst, inst_env_type *inst_env)
 /* Calculate the result of the instruction for ADD, SUB, CMP AND, OR and MOVE. 
    The MOVE instruction is the move from source to register.  */
 
-void 
+static void 
 add_sub_cmp_and_or_move_action (unsigned short inst, inst_env_type *inst_env, 
                                 unsigned long source1, unsigned long source2)
 {
@@ -3028,7 +3017,7 @@ add_sub_cmp_and_or_move_action (unsigned short inst, inst_env_type *inst_env,
    is zero extend then the value is extended with zero.  If instead the mode
    is signed extend the sign bit of the value is taken into consideration.  */
 
-unsigned long 
+static unsigned long 
 do_sign_or_zero_extend (unsigned long value, unsigned short *inst)
 {
   /* The size can be either byte or word, check which one it is. 
@@ -3066,7 +3055,7 @@ do_sign_or_zero_extend (unsigned long value, unsigned short *inst)
 /* Handles the register mode for the ADD, SUB, CMP, AND, OR and MOVE
    instruction.  The MOVE instruction is the move from source to register.  */
 
-void 
+static void 
 reg_mode_add_sub_cmp_and_or_move_op (unsigned short inst,
                                      inst_env_type *inst_env)
 {
@@ -3111,7 +3100,7 @@ reg_mode_add_sub_cmp_and_or_move_op (unsigned short inst,
    the size of the operation.  If the instruction is a zero or signed
    extend instruction, the size field is changed in instruction.  */
 
-unsigned long 
+static unsigned long 
 get_data_from_address (unsigned short *inst, CORE_ADDR address)
 {
   int size = cris_get_size (*inst);
@@ -3139,7 +3128,7 @@ get_data_from_address (unsigned short *inst, CORE_ADDR address)
 /* Handles the assign addresing mode for the ADD, SUB, CMP, AND, OR and MOVE 
    instructions.  The MOVE instruction is the move from source to register.  */
 
-void 
+static void 
 handle_prefix_assign_mode_for_aritm_op (unsigned short inst, 
                                         inst_env_type *inst_env)
 {
@@ -3168,7 +3157,7 @@ handle_prefix_assign_mode_for_aritm_op (unsigned short inst,
    OR instructions.  Note that for this to work as expected, the calling
    function must have made sure that there is a prefix to this instruction.  */
 
-void 
+static void 
 three_operand_add_sub_cmp_and_or_op (unsigned short inst, 
                                      inst_env_type *inst_env)
 {
@@ -3196,7 +3185,7 @@ three_operand_add_sub_cmp_and_or_op (unsigned short inst,
 /* Handles the index addresing mode for the ADD, SUB, CMP, AND, OR and MOVE
    instructions.  The MOVE instruction is the move from source to register.  */
 
-void 
+static void 
 handle_prefix_index_mode_for_aritm_op (unsigned short inst, 
                                        inst_env_type *inst_env)
 {
@@ -3224,7 +3213,7 @@ handle_prefix_index_mode_for_aritm_op (unsigned short inst,
    CMP, AND OR and MOVE instruction.  The MOVE instruction is the move from
    source to register.  */
 
-void 
+static void 
 handle_inc_and_index_mode_for_aritm_op (unsigned short inst, 
                                         inst_env_type *inst_env)
 {
@@ -3274,7 +3263,7 @@ handle_inc_and_index_mode_for_aritm_op (unsigned short inst,
 /* Handles the two-operand addressing mode, all modes except register, for
    the ADD, SUB CMP, AND and OR instruction.  */
 
-void 
+static void 
 none_reg_mode_add_sub_cmp_and_or_move_op (unsigned short inst, 
                                           inst_env_type *inst_env)
 {
@@ -3303,7 +3292,7 @@ none_reg_mode_add_sub_cmp_and_or_move_op (unsigned short inst,
 
 /* Handles the quick addressing mode for the ADD and SUB instruction.  */
 
-void 
+static void 
 quick_mode_add_sub_op (unsigned short inst, inst_env_type *inst_env)
 {
   unsigned long operand1;
@@ -3343,7 +3332,7 @@ quick_mode_add_sub_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Handles the quick addressing mode for the CMP, AND and OR instruction.  */
 
-void 
+static void 
 quick_mode_and_cmp_move_or_op (unsigned short inst, inst_env_type *inst_env)
 {
   unsigned long operand1;
@@ -3389,8 +3378,9 @@ quick_mode_and_cmp_move_or_op (unsigned short inst, inst_env_type *inst_env)
 
 /* Translate op_type to a function and call it.  */
 
-static void cris_gdb_func (enum cris_op_type op_type, unsigned short inst, 
-                           inst_env_type *inst_env)
+static void
+cris_gdb_func (enum cris_op_type op_type, unsigned short inst, 
+              inst_env_type *inst_env)
 {
   switch (op_type)
     {
@@ -3548,10 +3538,16 @@ static void cris_gdb_func (enum cris_op_type op_type, unsigned short inst,
    exec_bfd has been set.  */
 
 static int
-cris_delayed_get_disassembler (bfd_vma addr, disassemble_info *info)
+cris_delayed_get_disassembler (bfd_vma addr, struct disassemble_info *info)
 {
-  deprecated_tm_print_insn = cris_get_disassembler (exec_bfd);
-  return TARGET_PRINT_INSN (addr, info);
+  int (*print_insn) (bfd_vma addr, struct disassemble_info *info);
+  /* FIXME: cagney/2003-08-27: It should be possible to select a CRIS
+     disassembler, even when there is no BFD.  Does something like
+     "gdb; target remote; disassmeble *0x123" work?  */
+  gdb_assert (exec_bfd != NULL);
+  print_insn =  cris_get_disassembler (exec_bfd);
+  gdb_assert (print_insn != NULL);
+  return print_insn (addr, info);
 }
 
 /* Copied from <asm/elf.h>.  */
@@ -3562,7 +3558,7 @@ typedef elf_greg_t elf_gregset_t[35];
 
 /* Unpack an elf_gregset_t into GDB's register cache.  */
 
-void 
+static void 
 supply_gregset (elf_gregset_t *gregsetp)
 {
   int i;
@@ -3627,7 +3623,7 @@ static struct core_fns cris_elf_core_fns =
 
    See gdb/solib-svr4.h for an explanation of these fields.  */
 
-struct link_map_offsets *
+static struct link_map_offsets *
 cris_linux_svr4_fetch_link_map_offsets (void)
 { 
   static struct link_map_offsets lmo;
@@ -3855,6 +3851,8 @@ cris_fpless_backtrace (char *noargs, int from_tty)
     }
 }
 
+extern initialize_file_ftype _initialize_cris_tdep; /* -Wmissing-prototypes */
+
 void
 _initialize_cris_tdep (void)
 {
@@ -3862,9 +3860,6 @@ _initialize_cris_tdep (void)
 
   gdbarch_register (bfd_arch_cris, cris_gdbarch_init, cris_dump_tdep);
   
-  /* Used in disassembly.  */
-  deprecated_tm_print_insn = cris_delayed_get_disassembler;
-
   /* CRIS-specific user-commands.  */
   c = add_set_cmd ("cris-version", class_support, var_integer, 
                    (char *) &usr_cmd_cris_version, 
@@ -4161,7 +4156,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
                                       cris_abi_original_store_return_value);
       set_gdbarch_deprecated_extract_return_value 
         (gdbarch, cris_abi_original_extract_return_value);
-      set_gdbarch_reg_struct_has_addr 
+      set_gdbarch_deprecated_reg_struct_has_addr 
         (gdbarch, cris_abi_original_reg_struct_has_addr);
     }
   else if (tdep->cris_abi == CRIS_ABI_V2)
@@ -4171,8 +4166,8 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       set_gdbarch_deprecated_store_return_value (gdbarch, cris_abi_v2_store_return_value);
       set_gdbarch_deprecated_extract_return_value
        (gdbarch, cris_abi_v2_extract_return_value);
-      set_gdbarch_reg_struct_has_addr (gdbarch, 
-                                       cris_abi_v2_reg_struct_has_addr);
+      set_gdbarch_deprecated_reg_struct_has_addr
+       (gdbarch, cris_abi_v2_reg_struct_has_addr);
     }
   else
     internal_error (__FILE__, __LINE__, "cris_gdbarch_init: unknown CRIS ABI");
@@ -4239,21 +4234,21 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Returns the register offset for the first byte of register regno's space 
      in the saved register state.  */
-  set_gdbarch_register_byte (gdbarch, cris_register_offset);
+  set_gdbarch_deprecated_register_byte (gdbarch, cris_register_offset);
   
   /* The length of the registers in the actual machine representation.  */
-  set_gdbarch_register_raw_size (gdbarch, cris_register_size);
+  set_gdbarch_deprecated_register_raw_size (gdbarch, cris_register_size);
   
   /* The largest value REGISTER_RAW_SIZE can have.  */
   set_gdbarch_deprecated_max_register_raw_size (gdbarch, 32);
   
   /* The length of the registers in the program's representation.  */
-  set_gdbarch_register_virtual_size (gdbarch, cris_register_size);
+  set_gdbarch_deprecated_register_virtual_size (gdbarch, cris_register_size);
   
   /* The largest value REGISTER_VIRTUAL_SIZE can have.  */
   set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 32);
 
-  set_gdbarch_register_virtual_type (gdbarch, cris_register_virtual_type);
+  set_gdbarch_deprecated_register_virtual_type (gdbarch, cris_register_virtual_type);
   
   /* Use generic dummy frames.  */
   
@@ -4267,16 +4262,13 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   
   set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
   
-  /* No register requires conversion from raw format to virtual format.  */
-  set_gdbarch_register_convertible (gdbarch, generic_register_convertible_not);
-
   set_gdbarch_deprecated_push_return_address (gdbarch, cris_push_return_address);
   set_gdbarch_deprecated_pop_frame (gdbarch, cris_pop_frame);
 
   set_gdbarch_deprecated_store_struct_return (gdbarch, cris_store_struct_return);
   set_gdbarch_deprecated_extract_struct_value_address
     (gdbarch, cris_extract_struct_value_address);
-  set_gdbarch_use_struct_convention (gdbarch, cris_use_struct_convention);
+  set_gdbarch_use_struct_convention (gdbarch, always_use_struct_convention);
 
   set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, cris_frame_init_saved_regs);
   set_gdbarch_deprecated_init_extra_frame_info (gdbarch, cris_init_extra_frame_info);
@@ -4305,17 +4297,20 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_deprecated_frame_saved_pc (gdbarch, cris_frame_saved_pc);
   set_gdbarch_deprecated_saved_pc_after_call (gdbarch, cris_saved_pc_after_call);
 
-  set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
-  
   /* Helpful for backtracing and returning in a call dummy.  */
-  set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
+  set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
 
   /* Should be using push_dummy_call.  */
-  set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+  set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp);
 
   /* Use target_specific function to define link map offsets.  */
   set_solib_svr4_fetch_link_map_offsets 
     (gdbarch, cris_linux_svr4_fetch_link_map_offsets);
   
+  /* FIXME: cagney/2003-08-27: It should be possible to select a CRIS
+     disassembler, even when there is no BFD.  Does something like
+     "gdb; target remote; disassmeble *0x123" work?  */
+  set_gdbarch_print_insn (gdbarch, cris_delayed_get_disassembler);
+
   return gdbarch;
 }