2007-07-01 H.J. Lu <hongjiu.lu@intel.com>
[deliverable/binutils-gdb.git] / gdb / ppc-sysv-tdep.c
index ca465e2e0edeb1d261c02767ecb65d99c9c3ac14..e045ca8696fd08f0f963b9ef2043bde291ce1ae8 100644 (file)
@@ -51,10 +51,14 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
                              int struct_return, CORE_ADDR struct_addr)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
-  const CORE_ADDR saved_sp = read_sp ();
+  ULONGEST saved_sp;
   int argspace = 0;            /* 0 is an initial wrong guess.  */
   int write_pass;
 
+  regcache_cooked_read_unsigned (regcache,
+                                gdbarch_sp_regnum (current_gdbarch),
+                                &saved_sp);
+
   /* Go through the argument list twice.
 
      Pass 1: Figure out how much new stack space is required for
@@ -189,7 +193,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
              if (vreg <= 13)
                {
                  if (write_pass)
-                   regcache_cooked_write (current_regcache,
+                   regcache_cooked_write (regcache,
                                           tdep->ppc_vr0_regnum + vreg, val);
                  vreg++;
                }
@@ -215,7 +219,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
              if (greg <= 10)
                {
                  if (write_pass)
-                   regcache_cooked_write (current_regcache,
+                   regcache_cooked_write (regcache,
                                           tdep->ppc_ev0_regnum + greg, val);
                  greg++;
                }
@@ -305,7 +309,8 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
     }
 
   /* Update %sp.   */
-  regcache_cooked_write_signed (regcache, SP_REGNUM, sp);
+  regcache_cooked_write_signed (regcache,
+                               gdbarch_sp_regnum (current_gdbarch), sp);
 
   /* Write the backchain (it occupies WORDSIZED bytes).  */
   write_memory_signed_integer (sp, tdep->wordsize, saved_sp);
@@ -578,10 +583,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 {
   CORE_ADDR func_addr = find_function_addr (function, NULL);
   struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
-  /* By this stage in the proceedings, SP has been decremented by "red
-     zone size" + "struct return size".  Fetch the stack-pointer from
-     before this and use that as the BACK_CHAIN.  */
-  const CORE_ADDR back_chain = read_sp ();
+  ULONGEST back_chain;
   /* See for-loop comment below.  */
   int write_pass;
   /* Size of the Altivec's vector parameter region, the final value is
@@ -599,6 +601,13 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
      the possible values of tdep->wordsize.  */
   gdb_assert (tdep->wordsize == 8);
 
+  /* By this stage in the proceedings, SP has been decremented by "red
+     zone size" + "struct return size".  Fetch the stack-pointer from
+     before this and use that as the BACK_CHAIN.  */
+  regcache_cooked_read_unsigned (regcache,
+                                gdbarch_sp_regnum (current_gdbarch),
+                                &back_chain);
+
   /* Go through the argument list twice.
 
      Pass 1: Compute the function call's stack space and register
@@ -828,7 +837,8 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
     }
 
   /* Update %sp.   */
-  regcache_cooked_write_signed (regcache, SP_REGNUM, sp);
+  regcache_cooked_write_signed (regcache,
+                               gdbarch_sp_regnum (current_gdbarch), sp);
 
   /* Write the backchain (it occupies WORDSIZED bytes).  */
   write_memory_signed_integer (sp, tdep->wordsize, back_chain);
This page took 0.030021 seconds and 4 git commands to generate.