2003-09-14 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / rs6000-tdep.c
index f3e3d8c8dad82f5d1136104df3b53e7b89764ab0..e8e11e3c54180f851bbb612d37d80abf1ec20a3d 100644 (file)
@@ -1075,25 +1075,6 @@ rs6000_pop_frame (void)
   flush_cached_frames ();
 }
 
-/* Fixup the call sequence of a dummy function, with the real function
-   address.  Its arguments will be passed by gdb.  */
-
-static void
-rs6000_fix_call_dummy (char *dummyname, CORE_ADDR pc, CORE_ADDR fun,
-                      int nargs, struct value **args, struct type *type,
-                      int gcc_p)
-{
-  int ii;
-  CORE_ADDR target_addr;
-
-  if (rs6000_find_toc_address_hook != NULL)
-    {
-      CORE_ADDR tocvalue = (*rs6000_find_toc_address_hook) (fun);
-      write_register (gdbarch_tdep (current_gdbarch)->ppc_toc_regnum,
-                     tocvalue);
-    }
-}
-
 /* All the ABI's require 16 byte alignment.  */
 static CORE_ADDR
 rs6000_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
@@ -1265,14 +1246,6 @@ ran_out_of_registers_for_arguments:
       space = (space + 15) & -16;
       sp -= space;
 
-      /* This is another instance we need to be concerned about
-         securing our stack space. If we write anything underneath %sp
-         (r1), we might conflict with the kernel who thinks he is free
-         to use this area. So, update %sp first before doing anything
-         else.  */
-
-      write_register (SP_REGNUM, sp);
-
       /* If the last argument copied into the registers didn't fit there 
          completely, push the rest of it into stack.  */
 
@@ -1313,26 +1286,30 @@ ran_out_of_registers_for_arguments:
          ii += ((len + 3) & -4) / 4;
        }
     }
-  else
-    /* Secure stack areas first, before doing anything else.  */
-    write_register (SP_REGNUM, sp);
 
   /* set back chain properly */
   store_unsigned_integer (tmp_buffer, 4, saved_sp);
   write_memory (sp, tmp_buffer, 4);
 
-  target_store_registers (-1);
-  return sp;
-}
+  /* Set the stack pointer.  According to the ABI, the SP is ment to
+     be set _before_ the corresponding stack space is used.  No need
+     for that here though - the target has been completly stopped - it
+     isn't possible for an exception handler to stomp on the stack.  */
+  regcache_raw_write_signed (regcache, SP_REGNUM, sp);
 
-/* Function: ppc_push_return_address (pc, sp)
-   Set up the return address for the inferior function call.  */
+  /* Point the inferior function call's return address at the dummy's
+     breakpoint.  */
+  regcache_raw_write_signed (regcache, tdep->ppc_lr_regnum, bp_addr);
 
-static CORE_ADDR
-ppc_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
-{
-  write_register (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum,
-                 entry_point_address ());
+  /* Set the TOC register, get the value from the objfile reader
+     which, in turn, gets it from the VMAP table.  */
+  if (rs6000_find_toc_address_hook != NULL)
+    {
+      CORE_ADDR tocvalue = (*rs6000_find_toc_address_hook) (func_addr);
+      regcache_raw_write_signed (regcache, tdep->ppc_toc_regnum, tocvalue);
+    }
+
+  target_store_registers (-1);
   return sp;
 }
 
@@ -1486,7 +1463,7 @@ rs6000_in_solib_return_trampoline (CORE_ADDR pc, char *name)
 CORE_ADDR
 rs6000_skip_trampoline_code (CORE_ADDR pc)
 {
-  register unsigned int ii, op;
+  unsigned int ii, op;
   int rel;
   CORE_ADDR solib_target_pc;
   struct minimal_symbol *msymbol;
@@ -1826,7 +1803,7 @@ rs6000_frame_chain (struct frame_info *thisframe)
        frame.  */
     return read_memory_addr (get_frame_base (thisframe), wordsize);
 
-  if (inside_entry_file (get_frame_pc (thisframe))
+  if (deprecated_inside_entry_file (get_frame_pc (thisframe))
       || get_frame_pc (thisframe) == entry_point_address ())
     return 0;
 
@@ -2914,7 +2891,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     set_gdbarch_print_insn (gdbarch, gdb_print_insn_powerpc);
 
   set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
-  set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp);
 
   set_gdbarch_num_regs (gdbarch, v->nregs);
   set_gdbarch_num_pseudo_regs (gdbarch, v->npregs);
@@ -2938,7 +2914,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
   set_gdbarch_char_signed (gdbarch, 0);
 
-  set_gdbarch_deprecated_fix_call_dummy (gdbarch, rs6000_fix_call_dummy);
   set_gdbarch_frame_align (gdbarch, rs6000_frame_align);
   if (sysv_abi && wordsize == 8)
     /* PPC64 SYSV.  */
@@ -2947,7 +2922,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     /* PowerOpen / AIX 32 bit.  */
     set_gdbarch_frame_red_zone_size (gdbarch, 220);
   set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
-  set_gdbarch_deprecated_push_return_address (gdbarch, ppc_push_return_address);
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
   set_gdbarch_deprecated_register_convertible (gdbarch, rs6000_register_convertible);
This page took 0.024007 seconds and 4 git commands to generate.