* elf64-ppc.c (ppc64_elf_relocate_section): Optimize unaligned relocs.
[deliverable/binutils-gdb.git] / gdb / s390-tdep.c
index 18b7d108fe77f4719af63b39d97e7fe0c2122b03..10df09501b3503bd7b07b0a51f1c931fe1cef01e 100644 (file)
@@ -45,7 +45,7 @@
 
 /* Number of bytes of storage in the actual machine representation
    for register N.  */
-int
+static int
 s390_register_raw_size (int reg_nr)
 {
   if (S390_FP0_REGNUM <= reg_nr
@@ -55,21 +55,21 @@ s390_register_raw_size (int reg_nr)
     return 4;
 }
 
-int
+static int
 s390x_register_raw_size (int reg_nr)
 {
   return (reg_nr == S390_FPC_REGNUM)
     || (reg_nr >= S390_FIRST_ACR && reg_nr <= S390_LAST_ACR) ? 4 : 8;
 }
 
-int
+static int
 s390_cannot_fetch_register (int regno)
 {
   return (regno >= S390_FIRST_CR && regno < (S390_FIRST_CR + 9)) ||
     (regno >= (S390_FIRST_CR + 12) && regno <= S390_LAST_CR);
 }
 
-int
+static int
 s390_register_byte (int reg_nr)
 {
   if (reg_nr <= S390_GP_LAST_REGNUM)
@@ -119,7 +119,7 @@ struct frame_extra_info
 
 static CORE_ADDR s390_frame_saved_pc_nofix (struct frame_info *fi);
 
-int
+static int
 s390_readinstruction (bfd_byte instr[], CORE_ADDR at,
                      struct disassemble_info *info)
 {
@@ -150,7 +150,7 @@ s390_memset_extra_info (struct frame_extra_info *fextra_info)
 
 
 
-const char *
+static const char *
 s390_register_name (int reg_nr)
 {
   static char *register_names[] = {
@@ -175,7 +175,7 @@ s390_register_name (int reg_nr)
 
 
 
-int
+static int
 s390_stab_reg_to_regnum (int regno)
 {
   return regno >= 64 ? S390_PSWM_REGNUM - 64 :
@@ -210,7 +210,7 @@ is_arg_reg (int regidx)
 
  */
 
-int
+static int
 s390_get_frame_info (CORE_ADDR pc, struct frame_extra_info *fextra_info,
                     struct frame_info *fi, int init_extra_info)
 {
@@ -280,7 +280,7 @@ s390_get_frame_info (CORE_ADDR pc, struct frame_extra_info *fextra_info,
 
   memset (gprs_saved, 0, sizeof (gprs_saved));
   memset (fprs_saved, 0, sizeof (fprs_saved));
-  info.read_memory_func = dis_asm_read_memory;
+  info.read_memory_func = deprecated_tm_print_insn_info.read_memory_func;
 
   save_link_regidx = subtract_sp_regidx = 0;
   if (fextra_info)
@@ -675,14 +675,14 @@ s390_get_frame_info (CORE_ADDR pc, struct frame_extra_info *fextra_info,
 }
 
 
-int
+static int
 s390_check_function_end (CORE_ADDR pc)
 {
   bfd_byte instr[S390_MAX_INSTR_SIZE];
   disassemble_info info;
   int regidx, instrlen;
 
-  info.read_memory_func = dis_asm_read_memory;
+  info.read_memory_func = deprecated_tm_print_insn_info.read_memory_func;
   instrlen = s390_readinstruction (instr, pc, &info);
   if (instrlen < 0)
     return -1;
@@ -767,7 +767,7 @@ s390_sniff_pc_function_start (CORE_ADDR pc, struct frame_info *fi)
 
 
 
-CORE_ADDR
+static CORE_ADDR
 s390_function_start (struct frame_info *fi)
 {
   CORE_ADDR function_start = 0;
@@ -775,14 +775,14 @@ s390_function_start (struct frame_info *fi)
   if (get_frame_extra_info (fi) && get_frame_extra_info (fi)->initialised)
     function_start = get_frame_extra_info (fi)->function_start;
   else if (get_frame_pc (fi))
-    function_start = get_pc_function_start (get_frame_pc (fi));
+    function_start = get_frame_func (fi);
   return function_start;
 }
 
 
 
 
-int
+static int
 s390_frameless_function_invocation (struct frame_info *fi)
 {
   struct frame_extra_info fextra_info, *fextra_info_ptr;
@@ -819,7 +819,7 @@ s390_is_sigreturn (CORE_ADDR pc, struct frame_info *sighandler_fi,
 
   scontext = temp_sregs = 0;
 
-  info.read_memory_func = dis_asm_read_memory;
+  info.read_memory_func = deprecated_tm_print_insn_info.read_memory_func;
   instrlen = s390_readinstruction (instr, pc, &info);
   if (sigcaller_pc)
     *sigcaller_pc = 0;
@@ -881,7 +881,7 @@ s390_is_sigreturn (CORE_ADDR pc, struct frame_info *sighandler_fi,
   for the moment.
   For some reason the blockframe.c calls us with fi->next->fromleaf
   so this seems of little use to us. */
-CORE_ADDR
+static CORE_ADDR
 s390_init_frame_pc_first (int next_fromleaf, struct frame_info *fi)
 {
   CORE_ADDR sigcaller_pc;
@@ -901,7 +901,7 @@ s390_init_frame_pc_first (int next_fromleaf, struct frame_info *fi)
   return pc;
 }
 
-void
+static void
 s390_init_extra_frame_info (int fromleaf, struct frame_info *fi)
 {
   frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info));
@@ -916,7 +916,7 @@ s390_init_extra_frame_info (int fromleaf, struct frame_info *fi)
    &FEXTRA_INFOP contains struct frame_extra_info; TDATAP can be NULL,
    in which case the framedata are read.  */
 
-void
+static void
 s390_frame_init_saved_regs (struct frame_info *fi)
 {
 
@@ -941,15 +941,6 @@ s390_frame_init_saved_regs (struct frame_info *fi)
 
 
 
-CORE_ADDR
-s390_frame_args_address (struct frame_info *fi)
-{
-
-  /* Apparently gdb already knows gdb_args_offset itself */
-  return get_frame_base (fi);
-}
-
-
 static CORE_ADDR
 s390_frame_saved_pc_nofix (struct frame_info *fi)
 {
@@ -979,7 +970,7 @@ s390_frame_saved_pc_nofix (struct frame_info *fi)
   return 0;
 }
 
-CORE_ADDR
+static CORE_ADDR
 s390_frame_saved_pc (struct frame_info *fi)
 {
   CORE_ADDR saved_pc = 0, sig_pc;
@@ -1008,7 +999,7 @@ s390_frame_saved_pc (struct frame_info *fi)
 /* We want backtraces out of signal handlers so we don't set
    (get_frame_type (thisframe) == SIGTRAMP_FRAME) to 1 */
 
-CORE_ADDR
+static CORE_ADDR
 s390_frame_chain (struct frame_info *thisframe)
 {
   CORE_ADDR prev_fp = 0;
@@ -1088,7 +1079,7 @@ s390_frame_chain (struct frame_info *thisframe)
 
 /* a given return value in `regbuf' with a type `valtype', extract and copy its
    value into `valbuf' */
-void
+static void
 s390_extract_return_value (struct type *valtype, char *regbuf, char *valbuf)
 {
   /* floats and doubles are returned in fpr0. fpr's have a size of 8 bytes.
@@ -1146,11 +1137,11 @@ s390_promote_integer_argument (struct type *valtype, char *valbuf,
   return (value);
 }
 
-void
+static void
 s390_store_return_value (struct type *valtype, char *valbuf)
 {
   int arglen;
-  char *reg_buff = alloca (max (S390_FPR_SIZE, REGISTER_SIZE)), *value;
+  char *reg_buff = alloca (max (S390_FPR_SIZE, DEPRECATED_REGISTER_SIZE)), *value;
 
   if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
     {
@@ -1194,7 +1185,7 @@ gdb_print_insn_s390 (bfd_vma memaddr, disassemble_info * info)
 
 
 /* Not the most efficent code in the world */
-int
+static int
 s390_fp_regnum (void)
 {
   int regno = S390_SP_REGNUM;
@@ -1209,7 +1200,7 @@ s390_fp_regnum (void)
   return regno;
 }
 
-CORE_ADDR
+static CORE_ADDR
 s390_read_fp (void)
 {
   return read_register (s390_fp_regnum ());
@@ -1251,7 +1242,7 @@ s390_pop_frame_regular (struct frame_info *frame)
    machine state that was in effect before the frame was created. 
    Used in the contexts of the "return" command, and of 
    target function calls from the debugger.  */
-void
+static void
 s390_pop_frame (void)
 {
   /* This function checks for and handles generic dummy frames, and
@@ -1501,7 +1492,7 @@ alignment_of (struct type *type)
 
    Our caller has taken care of any type promotions needed to satisfy
    prototypes or the old K&R argument-passing rules.  */
-CORE_ADDR
+static CORE_ADDR
 s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
                     int struct_return, CORE_ADDR struct_addr)
 {
@@ -1658,12 +1649,21 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
      frame.  This will help us get backtraces from within functions
      called from GDB.  */
   write_memory_unsigned_integer (sp, (TARGET_PTR_BIT / TARGET_CHAR_BIT),
-                                 read_fp ());
+                                 deprecated_read_fp ());
 
   return sp;
 }
 
 
+static CORE_ADDR
+s390_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
+{
+  /* Both the 32- and 64-bit ABI's say that the stack pointer should
+     always be aligned on an eight-byte boundary.  */
+  return (addr & -8);
+}
+
+
 static int
 s390_use_struct_convention (int gcc_p, struct type *value_type)
 {
@@ -1676,7 +1676,7 @@ s390_use_struct_convention (int gcc_p, struct type *value_type)
 
 /* Return the GDB type object for the "standard" data type
    of data in register N.  */
-struct type *
+static struct type *
 s390_register_virtual_type (int regno)
 {
   if (S390_FP0_REGNUM <= regno && regno < S390_FP0_REGNUM + S390_NUM_FPRS)
@@ -1686,7 +1686,7 @@ s390_register_virtual_type (int regno)
 }
 
 
-struct type *
+static struct type *
 s390x_register_virtual_type (int regno)
 {
   return (regno == S390_FPC_REGNUM) ||
@@ -1696,7 +1696,7 @@ s390x_register_virtual_type (int regno)
 
 
 
-void
+static void
 s390_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
 {
   write_register (S390_GP0_REGNUM + 2, addr);
@@ -1704,7 +1704,7 @@ s390_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
 
 
 
-const static unsigned char *
+static const unsigned char *
 s390_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
 {
   static unsigned char breakpoint[] = { 0x0, 0x1 };
@@ -1715,7 +1715,7 @@ s390_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
 
 /* Advance PC across any function entry prologue instructions to reach some
    "real" code.  */
-CORE_ADDR
+static CORE_ADDR
 s390_skip_prologue (CORE_ADDR pc)
 {
   struct frame_extra_info fextra_info;
@@ -1728,7 +1728,7 @@ s390_skip_prologue (CORE_ADDR 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.  */
-CORE_ADDR
+static CORE_ADDR
 s390_saved_pc_after_call (struct frame_info *frame)
 {
   return ADDR_BITS_REMOVE (read_register (S390_RETADDR_REGNUM));
@@ -1766,7 +1766,7 @@ s390_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags)
     return NULL;
 }
 
-int
+static int
 s390_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name,
                                       int *type_flags_ptr)
 {
@@ -1779,7 +1779,7 @@ s390_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name
     return 0;
 }
 
-struct gdbarch *
+static struct gdbarch *
 s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
   static LONGEST s390_call_dummy_words[] = { 0 };
@@ -1807,18 +1807,14 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_char_signed (gdbarch, 0);
 
   set_gdbarch_frame_args_skip (gdbarch, 0);
-  set_gdbarch_frame_args_address (gdbarch, s390_frame_args_address);
   set_gdbarch_deprecated_frame_chain (gdbarch, s390_frame_chain);
   set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, s390_frame_init_saved_regs);
-  set_gdbarch_frame_locals_address (gdbarch, s390_frame_args_address);
-  /* We can't do this */
-  set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
   set_gdbarch_deprecated_store_struct_return (gdbarch, s390_store_struct_return);
   set_gdbarch_deprecated_extract_return_value (gdbarch, s390_extract_return_value);
   set_gdbarch_deprecated_store_return_value (gdbarch, s390_store_return_value);
-  /* 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.  */
   set_gdbarch_decr_pc_after_break (gdbarch, 2);
   set_gdbarch_deprecated_pop_frame (gdbarch, s390_pop_frame);
   /* Stack grows downward.  */
@@ -1832,7 +1828,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_skip_prologue (gdbarch, s390_skip_prologue);
   set_gdbarch_deprecated_init_extra_frame_info (gdbarch, s390_init_extra_frame_info);
   set_gdbarch_deprecated_init_frame_pc_first (gdbarch, s390_init_frame_pc_first);
-  set_gdbarch_read_fp (gdbarch, s390_read_fp);
+  set_gdbarch_deprecated_target_read_fp (gdbarch, s390_read_fp);
   /* This function 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.  */
@@ -1843,11 +1839,11 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* DEPRECATED_FRAME_CHAIN takes a frame's nominal address and
      produces the frame's chain-pointer. */
   set_gdbarch_deprecated_frame_chain (gdbarch, s390_frame_chain);
-  set_gdbarch_saved_pc_after_call (gdbarch, s390_saved_pc_after_call);
-  set_gdbarch_register_byte (gdbarch, s390_register_byte);
+  set_gdbarch_deprecated_saved_pc_after_call (gdbarch, s390_saved_pc_after_call);
+  set_gdbarch_deprecated_register_byte (gdbarch, s390_register_byte);
   set_gdbarch_pc_regnum (gdbarch, S390_PC_REGNUM);
   set_gdbarch_sp_regnum (gdbarch, S390_SP_REGNUM);
-  set_gdbarch_fp_regnum (gdbarch, S390_FP_REGNUM);
+  set_gdbarch_deprecated_fp_regnum (gdbarch, S390_FP_REGNUM);
   set_gdbarch_fp0_regnum (gdbarch, S390_FP0_REGNUM);
   set_gdbarch_num_regs (gdbarch, S390_NUM_REGS);
   set_gdbarch_cannot_fetch_register (gdbarch, s390_cannot_fetch_register);
@@ -1861,43 +1857,36 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     (gdbarch, generic_cannot_extract_struct_value_address);
 
   /* Parameters for inferior function calls.  */
-  set_gdbarch_call_dummy_p (gdbarch, 1);
-  set_gdbarch_call_dummy_length (gdbarch, 0);
-  set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
-  set_gdbarch_call_dummy_start_offset (gdbarch, 0);
   set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
-  set_gdbarch_push_arguments (gdbarch, s390_push_arguments);
-  set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
-  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_push_return_address (gdbarch, s390_push_return_address);
-  set_gdbarch_sizeof_call_dummy_words (gdbarch,
-                                       sizeof (s390_call_dummy_words));
-  set_gdbarch_call_dummy_words (gdbarch, s390_call_dummy_words);
+  set_gdbarch_frame_align (gdbarch, s390_frame_align);
+  set_gdbarch_deprecated_push_arguments (gdbarch, s390_push_arguments);
+  set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
+  set_gdbarch_deprecated_push_return_address (gdbarch,
+                                              s390_push_return_address);
+  set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, sizeof (s390_call_dummy_words));
+  set_gdbarch_deprecated_call_dummy_words (gdbarch, s390_call_dummy_words);
 
   switch (info.bfd_arch_info->mach)
     {
     case bfd_mach_s390_31:
-      set_gdbarch_register_size (gdbarch, 4);
-      set_gdbarch_register_raw_size (gdbarch, s390_register_raw_size);
-      set_gdbarch_register_virtual_size (gdbarch, s390_register_raw_size);
-      set_gdbarch_register_virtual_type (gdbarch, s390_register_virtual_type);
+      set_gdbarch_deprecated_register_size (gdbarch, 4);
+      set_gdbarch_deprecated_register_raw_size (gdbarch, s390_register_raw_size);
+      set_gdbarch_deprecated_register_virtual_size (gdbarch, s390_register_raw_size);
+      set_gdbarch_deprecated_register_virtual_type (gdbarch, s390_register_virtual_type);
 
       set_gdbarch_addr_bits_remove (gdbarch, s390_addr_bits_remove);
-      set_gdbarch_register_bytes (gdbarch, S390_REGISTER_BYTES);
+      set_gdbarch_deprecated_register_bytes (gdbarch, S390_REGISTER_BYTES);
       break;
     case bfd_mach_s390_64:
-      set_gdbarch_register_size (gdbarch, 8);
-      set_gdbarch_register_raw_size (gdbarch, s390x_register_raw_size);
-      set_gdbarch_register_virtual_size (gdbarch, s390x_register_raw_size);
-      set_gdbarch_register_virtual_type (gdbarch,
-                                        s390x_register_virtual_type);
+      set_gdbarch_deprecated_register_size (gdbarch, 8);
+      set_gdbarch_deprecated_register_raw_size (gdbarch, s390x_register_raw_size);
+      set_gdbarch_deprecated_register_virtual_size (gdbarch, s390x_register_raw_size);
+      set_gdbarch_deprecated_register_virtual_type (gdbarch, s390x_register_virtual_type);
 
       set_gdbarch_long_bit (gdbarch, 64);
       set_gdbarch_long_long_bit (gdbarch, 64);
       set_gdbarch_ptr_bit (gdbarch, 64);
-      set_gdbarch_register_bytes (gdbarch, S390X_REGISTER_BYTES);
+      set_gdbarch_deprecated_register_bytes (gdbarch, S390X_REGISTER_BYTES);
       set_gdbarch_address_class_type_flags (gdbarch,
                                             s390_address_class_type_flags);
       set_gdbarch_address_class_type_flags_to_name (gdbarch,
@@ -1907,19 +1896,24 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       break;
     }
 
+  /* Should be using push_dummy_call.  */
+  set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp);
+
   return gdbarch;
 }
 
 
 
+extern initialize_file_ftype _initialize_s390_tdep; /* -Wmissing-prototypes */
+
 void
 _initialize_s390_tdep (void)
 {
 
   /* Hook us into the gdbarch mechanism.  */
   register_gdbarch_init (bfd_arch_s390, s390_gdbarch_init);
-  if (!tm_print_insn)          /* Someone may have already set it */
-    tm_print_insn = gdb_print_insn_s390;
+  if (!deprecated_tm_print_insn)       /* Someone may have already set it */
+    deprecated_tm_print_insn = gdb_print_insn_s390;
 }
 
 #endif /* GDBSERVER */
This page took 0.051651 seconds and 4 git commands to generate.