[RFA] Convert sparc64 fully to entry point call dummy

David S. Miller davem@redhat.com
Sat Apr 20 04:10:00 GMT 2002


Basically:

1) Sparc32 can never use anything other than ON_STACK for call
   dummys.  This is in order to get proper nesting of functions
   returning structures, ie. the unimp after call convention.

   There is no reason to keep around code that supports entry
   point call dummys because it can never work.

2) Sparc64 basically has to use entry point call dummys or something
   similar.  Luckily it can as it lacks the silly unimp after call
   convention for functions returning structures.

   The reason it cannot use ON_STACK is because many systems protect
   the process stack such that you cannot execute code on it.
   Solaris is one such Sparc system that configures by default to do
   this for 64-bit applications.

There is a dummy frame tracking mechanism added here, and as I
mentioned on this list the other day one of the first things I'm going
to do once all my bits are reviewed and installed is to convert this
to use the generic call dummy bits as much as possible.

		sparc32			sparc64
failures before	83			105
failures after	83			101

2002-04-20  David S. Miller  <davem@redhat.com>

	Convert sparc64 to use AT_ENTRY_POINT call dummy.
	* config/sparc/tm-sp64.h (CALL_DUMMY): Delete.
	(CALL_DUMMY_LENGTH, CALL_DUMMY_START_OFFSET,
	CALL_DUMMY_CALL_OFFSET, CALL_DUMMY_BREAKPOINT_OFFSET): Set all to
	zero.
	(CALL_DUMMY_LOCATION): Set to AT_ENTRY_POINT.
	(FIX_CALL_DUMMY): Now a nop.
	(PUSH_RETURN_ADDRESS): Define.
	(FRAME_ARGS_SKIP): Fix, should be 128
	* sparc-tdep.c (dummy_frame_desc): New struct.
	(frame_extra_info): Add dummy_info entry.
	(dummy_frames): List of dummy frames.
	(new_dummy_frame, dummy_frame_for_sp, destroy_dummy_frame): New
	functions.
	(sparc_init_extra_frame_info): Check dummy_info to determine if
	a dummy frame.  Initialize extra_info->dummy_info for new frame.
	(sparc_frame_saved_pc): Check dummy_info to determine if a dummy
	frame.
	(sparc_get_saved_register): Likewise.
	(sparc_frame_find_saved_regs): Likewise.
	(sparc_pop_frame): If dummy frame, call destroy_dummy_frame.
	(sparc_fix_call_dummy): Verify !arch64.
	(sparc_push_return_address): Call new_dummy_frame.  Verify we are
	arch64 if AT_ENTRY_POINT, else ON_STACK and !arch64.
	(sparc32_store_struct_return): Delete AT_ENTRY_POINT code.
	(sparc64_store_struct_return): Likewise.
	(sparc_gdbarch_fix_call_dummy): If !ON_STACK verify we are arch64.
	(SPARC32_CALL_DUMMY_ON_STACK): Delete.
	(call_dummy_64): Delete.
	(bfd_mach_sparc 32-bit cases): Document why ON_STACK is the only
	method that will work on 32-bit sparc.  Delete all code protected
	by !SPARC32_CALL_DUMMY_ON_STACK.
	(bfd_mach_sparc 64-bit cases): Delete all ON_STACK support, it
	cannot work this way because many platform execute protect
	the stack.  Initialize for AT_ENTRY_POINT values.
	
--- config/sparc/tm-sp64.h.~1~	Sat Apr 20 01:55:05 2002
+++ config/sparc/tm-sp64.h	Sat Apr 20 03:19:12 2002
@@ -31,135 +31,33 @@
 
 #include "sparc/tm-sparc.h"
 
-/* Eeeew. Ok, we have to assume (for now) that the processor really is
-   in sparc64 mode. While this is the same instruction sequence as
-   on the Sparc, the stack frames are offset by +2047 (and the arguments
-   are 8 bytes instead of 4). */
-/* Instructions are:
-   std  %f10, [ %fp + 0x7a7 ]
-   std  %f8, [ %fp + 0x79f ]
-   std  %f6, [ %fp + 0x797 ]
-   std  %f4, [ %fp + 0x78f ]
-   std  %f2, [ %fp + 0x787 ]
-   std  %f0, [ %fp + 0x77f ]
-   std  %g6, [ %fp + 0x777 ]
-   std  %g4, [ %fp + 0x76f ]
-   std  %g2, [ %fp + 0x767 ]
-   std  %g0, [ %fp + 0x75f ]
-   std  %fp, [ %fp + 0x757 ]
-   std  %i4, [ %fp + 0x74f ]
-   std  %i2, [ %fp + 0x747 ]
-   std  %i0, [ %fp + 0x73f ]
-   nop
-   nop
-   nop
-   nop
-   rd  %tbr, %o0
-   st  %o0, [ %fp + 0x72b ]
-   rd  %tpc, %o0
-   st  %o0, [ %fp + 0x727 ]
-   rd  %psr, %o0
-   st  %o0, [ %fp + 0x723 ]
-   rd  %y, %o0
-   st  %o0, [ %fp + 0x71f ]
-   ldx  [ %sp + 0x8a7 ], %o5
-   ldx  [ %sp + 0x89f ], %o4
-   ldx  [ %sp + 0x897 ], %o3
-   ldx  [ %sp + 0x88f ], %o2
-   ldx  [ %sp + 0x887 ], %o1
-   call  %g0
-   ldx  [ %sp + 0x87f ], %o0
-   nop
-   ta  1
-   nop
-   nop
- */
+/* For the dummy call on sparc64, we don't have the 'unimp' instruction
+   after calls to functions returning structures, so we can just
+   us AT_ENTRY_POINT for CALL_DUMMY.  */
 
 #if !defined (GDB_MULTI_ARCH) || (GDB_MULTI_ARCH == 0)
-/*
- * The following defines must go away for MULTI_ARCH.
- */
-
-#ifndef DO_CALL_DUMMY_ON_STACK
-
-/*
- * These defines will suffice for the AT_ENTRY_POINT call dummy method.
- */
-
-#undef  CALL_DUMMY
-#define CALL_DUMMY {0}
-#undef  CALL_DUMMY_LENGTH
-#define CALL_DUMMY_LENGTH 0
-#undef  CALL_DUMMY_CALL_OFFSET
-#define CALL_DUMMY_CALL_OFFSET 0
-#undef  CALL_DUMMY_START_OFFSET
-#define CALL_DUMMY_START_OFFSET 0
-#undef  CALL_DUMMY_BREAKPOINT_OFFSET
-#define CALL_DUMMY_BREAKPOINT_OFFSET 0
-#undef  CALL_DUMMY_BREAKPOINT_OFFSET_P
-#define CALL_DUMMY_BREAKPOINT_OFFSET_P 1
-#undef  CALL_DUMMY_LOCATION 
-#define CALL_DUMMY_LOCATION AT_ENTRY_POINT
-#undef  CALL_DUMMY_STACK_ADJUST
-#define CALL_DUMMY_STACK_ADJUST 128
-#undef  SIZEOF_CALL_DUMMY_WORDS
-#define SIZEOF_CALL_DUMMY_WORDS 0
-#undef  CALL_DUMMY_ADDRESS
-#define CALL_DUMMY_ADDRESS() entry_point_address()
-#undef  FIX_CALL_DUMMY
-#define FIX_CALL_DUMMY(DUMMYNAME, PC, FUN, NARGS, ARGS, TYPE, GCC_P) 
-#undef  PUSH_RETURN_ADDRESS
-#define PUSH_RETURN_ADDRESS(PC, SP) sparc_at_entry_push_return_address (PC, SP)
-extern CORE_ADDR 
-sparc_at_entry_push_return_address (CORE_ADDR pc, CORE_ADDR sp);
-
-#undef  STORE_STRUCT_RETURN
-#define STORE_STRUCT_RETURN(ADDR, SP) \
-     sparc_at_entry_store_struct_return (ADDR, SP)
-extern void 
-sparc_at_entry_store_struct_return (CORE_ADDR addr, CORE_ADDR sp);
-
-
-#else
-/*
- * Old call dummy method, with CALL_DUMMY on the stack.
- */
-
-#undef  CALL_DUMMY
-#define CALL_DUMMY {		 0x9de3bec0fd3fa7f7LL, 0xf93fa7eff53fa7e7LL,\
-				 0xf13fa7dfed3fa7d7LL, 0xe93fa7cfe53fa7c7LL,\
-				 0xe13fa7bfdd3fa7b7LL, 0xd93fa7afd53fa7a7LL,\
-				 0xd13fa79fcd3fa797LL, 0xc93fa78fc53fa787LL,\
-				 0xc13fa77fcc3fa777LL, 0xc83fa76fc43fa767LL,\
-				 0xc03fa75ffc3fa757LL, 0xf83fa74ff43fa747LL,\
-				 0xf03fa73f01000000LL, 0x0100000001000000LL,\
-				 0x0100000091580000LL, 0xd027a72b93500000LL,\
-				 0xd027a72791480000LL, 0xd027a72391400000LL,\
-				 0xd027a71fda5ba8a7LL, 0xd85ba89fd65ba897LL,\
-				 0xd45ba88fd25ba887LL, 0x9fc02000d05ba87fLL,\
-				 0x0100000091d02001LL, 0x0100000001000000LL }
 
 
 /* 128 is to reserve space to write the %i/%l registers that will be restored
-   when we resume. */
+   when we resume.  */
 #undef  CALL_DUMMY_STACK_ADJUST
 #define CALL_DUMMY_STACK_ADJUST 128
 
 /* Size of the call dummy in bytes. */
 #undef  CALL_DUMMY_LENGTH
-#define CALL_DUMMY_LENGTH 192
+#define CALL_DUMMY_LENGTH 0x0
 
 /* Offset within CALL_DUMMY of the 'call' instruction. */
 #undef  CALL_DUMMY_START_OFFSET
-#define CALL_DUMMY_START_OFFSET 148
+#define CALL_DUMMY_START_OFFSET 0x0
 
 /* Offset within CALL_DUMMY of the 'call' instruction. */
 #undef  CALL_DUMMY_CALL_OFFSET
-#define CALL_DUMMY_CALL_OFFSET (CALL_DUMMY_START_OFFSET + (5 * 4))
+#define CALL_DUMMY_CALL_OFFSET (CALL_DUMMY_START_OFFSET + 0x0)
 
 /* Offset within CALL_DUMMY of the 'ta 1' instruction. */
 #undef  CALL_DUMMY_BREAKPOINT_OFFSET
-#define CALL_DUMMY_BREAKPOINT_OFFSET (CALL_DUMMY_START_OFFSET + (8 * 4))
+#define CALL_DUMMY_BREAKPOINT_OFFSET (CALL_DUMMY_START_OFFSET + 0x0)
 
 /* Let's GDB know that it can make a call_dummy breakpoint.  */
 #undef  CALL_DUMMY_BREAKPOINT_OFFSET_P
@@ -167,24 +65,21 @@ sparc_at_entry_store_struct_return (CORE
 
 /* Call dummy will be located on the stack.  */
 #undef  CALL_DUMMY_LOCATION
-#define CALL_DUMMY_LOCATION ON_STACK
+#define CALL_DUMMY_LOCATION AT_ENTRY_POINT
 
 /* Insert the function address into the call dummy.  */
 #undef  FIX_CALL_DUMMY
 #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
- sparc_fix_call_dummy (dummyname, pc, fun, type, gcc_p)
-void sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
-			   struct type *value_type, int using_gcc);
+	do { } while (0)
 
+#define PUSH_RETURN_ADDRESS(PC, SP) \
+	write_register (O7_REGNUM, CALL_DUMMY_ADDRESS() - 8)
 
 /* The remainder of these will accept the default definition.  */
 #undef  SIZEOF_CALL_DUMMY_WORDS
-#undef  PUSH_RETURN_ADDRESS
 #undef  CALL_DUMMY_ADDRESS
 #undef  STORE_STRUCT_RETURN
 
-#endif
-
 /* Does the specified function use the "struct returning" convention
    or the "value returning" convention?  The "value returning" convention
    almost invariably returns the entire value in registers.  The
@@ -434,7 +329,7 @@ extern void sp64_extract_return_value (s
 /* Return number of bytes at start of arglist that are not really args.  */
 
 #undef  FRAME_ARGS_SKIP
-#define FRAME_ARGS_SKIP 136
+#define FRAME_ARGS_SKIP 128
 
 #endif /* GDB_MULTI_ARCH */
 
--- sparc-tdep.c.~1~	Sat Apr 20 02:22:28 2002
+++ sparc-tdep.c	Sat Apr 20 03:23:24 2002
@@ -267,11 +267,19 @@ sparc_software_single_step (enum target_
     }
 }
 
+struct dummy_frame_desc
+  {
+    struct dummy_frame_desc *next;
+    CORE_ADDR sp;
+  };
+
 struct frame_extra_info 
 {
   CORE_ADDR bottom;
   int in_prologue;
   int flat;
+  /* This field non-NULL for a dummy frame.  */
+  struct dummy_frame_desc *dummy_info;
   /* Following fields only relevant for flat frames.  */
   CORE_ADDR pc_addr;
   CORE_ADDR fp_addr;
@@ -280,6 +288,53 @@ struct frame_extra_info 
   int sp_offset;
 };
 
+static struct dummy_frame_desc *dummy_frames;
+
+static void
+new_dummy_frame (CORE_ADDR sp)
+{
+  struct dummy_frame_desc *dp = (struct dummy_frame_desc *)xmalloc (sizeof (*dp));
+
+  dp->sp = sp;
+  dp->next = dummy_frames;
+  dummy_frames = dp;
+}
+
+static struct dummy_frame_desc *
+dummy_frame_for_sp(CORE_ADDR sp)
+{
+  struct dummy_frame_desc *dp;
+
+  for (dp = dummy_frames; dp != NULL; dp = dp->next)
+    {
+      if (dp->sp == sp)
+	break;
+    }
+
+  return dp;
+}
+
+static void
+destroy_dummy_frame (struct frame_info *fi)
+{
+  struct dummy_frame_desc *dp, **dpp;
+
+  dpp = &dummy_frames;
+  while ((dp = *dpp) != NULL)
+    {
+      if (dp->sp == fi->extra_info->bottom)
+	break;
+      dpp = &dp->next;
+    }
+
+  gdb_assert (dp != NULL && dp == fi->extra_info->dummy_info);
+
+  *dpp = dp->next;
+  fi->extra_info->dummy_info = NULL;
+
+  xfree (dp);
+}
+
 static CORE_ADDR examine_prologue (CORE_ADDR, int, struct frame_info *,
 				   CORE_ADDR *);
 
@@ -317,7 +372,7 @@ sparc_init_extra_frame_info (int fromlea
          it later.  */
       if (fi->next->next != NULL
 	  && (fi->next->next->signal_handler_caller
-	      || frame_in_dummy (fi->next->next))
+	      || fi->next->next->extra_info->dummy_info != NULL)
 	  && frameless_look_for_prologue (fi->next))
 	{
 	  /* A frameless function interrupted by a signal did not change
@@ -336,6 +391,8 @@ sparc_init_extra_frame_info (int fromlea
 	}
     }
 
+  fi->extra_info->dummy_info = dummy_frame_for_sp (fi->extra_info->bottom);
+
   /* Decide whether this is a function with a ``flat register window''
      frame.  For such functions, the frame pointer is actually in %i7.  */
   fi->extra_info->flat = 0;
@@ -485,7 +542,7 @@ sparc_frame_saved_pc (struct frame_info 
   else if (frame->extra_info->in_prologue ||
 	   (frame->next != NULL &&
 	    (frame->next->signal_handler_caller ||
-	     frame_in_dummy (frame->next)) &&
+	     frame->next->extra_info->dummy_info != NULL) &&
 	    frameless_look_for_prologue (frame)))
     {
       /* A frameless function interrupted by a signal did not save
@@ -826,11 +883,7 @@ sparc_get_saved_register (char *raw_buff
 
   while (frame1 != NULL)
     {
-      /* FIXME MVS: wrong test for dummy frame at entry.  */
-
-      if (frame1->pc >= (frame1->extra_info->bottom ? 
-			 frame1->extra_info->bottom : read_sp ())
-	  && frame1->pc <= FRAME_FP (frame1))
+      if (frame1->extra_info->dummy_info != NULL)
 	{
 	  /* Dummy frame.  All but the window regs are in there somewhere.
 	     The window registers are saved on the stack, just like in a
@@ -1087,9 +1140,7 @@ sparc_frame_find_saved_regs (struct fram
 
   memset (saved_regs_addr, 0, NUM_REGS * sizeof (CORE_ADDR));
 
-  if (fi->pc >= (fi->extra_info->bottom ? 
-		 fi->extra_info->bottom : read_sp ())
-      && fi->pc <= FRAME_FP (fi))
+  if (fi->extra_info->dummy_info != NULL)
     {
       /* Dummy frame.  All but the window regs are in there somewhere. */
       for (regnum = G1_REGNUM; regnum < G1_REGNUM + 7; regnum++)
@@ -1349,6 +1400,10 @@ sparc_pop_frame (void)
       write_register (PC_REGNUM, pc);
       write_register (NPC_REGNUM, pc + 4);
     }
+
+  if (frame->extra_info->dummy_info != NULL)
+    destroy_dummy_frame (frame);
+
   flush_cached_frames ();
 }
 
@@ -2181,6 +2236,8 @@ sparc_fix_call_dummy (char *dummy, CORE_
 {
   int i;
 
+  gdb_assert (! GDB_TARGET_IS_SPARC64);
+
   /* Store the relative adddress of the target function into the
      'call' instruction. */
   store_unsigned_integer (dummy + CALL_DUMMY_CALL_OFFSET, 4,
@@ -3112,8 +3169,12 @@ sparclet_register_name (int regno)
 CORE_ADDR
 sparc_push_return_address (CORE_ADDR pc_unused, CORE_ADDR sp)
 {
+  new_dummy_frame (sp - CALL_DUMMY_STACK_ADJUST);
+
   if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT)
     {
+      gdb_assert (GDB_TARGET_IS_SPARC64);
+
       /* The return PC of the dummy_frame is the former 'current' PC
 	 (where we were before we made the target function call).
 	 This is saved in %i7 by push_dummy_frame.
@@ -3126,6 +3187,11 @@ sparc_push_return_address (CORE_ADDR pc_
       write_register (O7_REGNUM, 
 		      CALL_DUMMY_ADDRESS () - 8);
     }
+  else
+    {
+      gdb_assert (! GDB_TARGET_IS_SPARC64
+		  && CALL_DUMMY_LOCATION == ON_STACK);
+    }
 
   return sp;
 }
@@ -3154,17 +3220,6 @@ sparc32_store_struct_return (CORE_ADDR a
   val = alloca (SPARC_INTREG_SIZE); 
   store_unsigned_integer (val, SPARC_INTREG_SIZE, addr);
   write_memory (sp + (16 * SPARC_INTREG_SIZE), val, SPARC_INTREG_SIZE); 
-
-  if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT)
-    {
-      /* Now adjust the value of the link register, which was previously
-	 stored by push_return_address.  Functions that return structs are
-	 peculiar in that they return to link register + 12, rather than
-	 link register + 8.  */
-
-      o7 = read_register (O7_REGNUM);
-      write_register (O7_REGNUM, o7 - 4);
-    }
 }
 
 static void
@@ -3175,17 +3230,6 @@ sparc64_store_struct_return (CORE_ADDR a
 
   target_write_memory (sp + (16 * SPARC_INTREG_SIZE), 
 		       (char *) &addr, SPARC_INTREG_SIZE); 
-#if 0
-  if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT)
-    {
-      /* Now adjust the value of the link register, which was previously
-	 stored by push_return_address.  Functions that return structs are
-	 peculiar in that they return to link register + 12, rather than
-	 link register + 8.  */
-
-      write_register (O7_REGNUM, read_register (O7_REGNUM) - 4);
-    }
-#endif
 }
 
 /* Default target data type for register REGNO.  */
@@ -3325,6 +3369,8 @@ sparc_gdbarch_fix_call_dummy (char *dumm
 {
   if (CALL_DUMMY_LOCATION == ON_STACK)
     sparc_fix_call_dummy (dummy, pc, fun, type, gcc_p);
+  else
+    gdb_assert (GDB_TARGET_IS_SPARC64);
 }
 
 /* Coerce float to double: a no-op.  */
@@ -3380,8 +3426,6 @@ sparc_return_value_on_stack (struct type
  * Gdbarch "constructor" function.
  */
 
-#define SPARC32_CALL_DUMMY_ON_STACK
-
 #define SPARC_SP_REGNUM    14
 #define SPARC_FP_REGNUM    30
 #define SPARC_FP0_REGNUM   32
@@ -3404,20 +3448,6 @@ sparc_gdbarch_init (struct gdbarch_info 
       0xd203a048, 0x40000000, 0xd003a044, 0x01000000,
       0x91d02001, 0x01000000
     };
-  static LONGEST call_dummy_64[] = 
-    { 0x9de3bec0fd3fa7f7LL, 0xf93fa7eff53fa7e7LL,
-      0xf13fa7dfed3fa7d7LL, 0xe93fa7cfe53fa7c7LL,
-      0xe13fa7bfdd3fa7b7LL, 0xd93fa7afd53fa7a7LL,
-      0xd13fa79fcd3fa797LL, 0xc93fa78fc53fa787LL,
-      0xc13fa77fcc3fa777LL, 0xc83fa76fc43fa767LL,
-      0xc03fa75ffc3fa757LL, 0xf83fa74ff43fa747LL,
-      0xf03fa73f01000000LL, 0x0100000001000000LL,
-      0x0100000091580000LL, 0xd027a72b93500000LL,
-      0xd027a72791480000LL, 0xd027a72391400000LL,
-      0xd027a71fda5ba8a7LL, 0xd85ba89fd65ba897LL,
-      0xd45ba88fd25ba887LL, 0x9fc02000d05ba87fLL,
-      0x0100000091d02001LL, 0x0100000001000000LL 
-    };
   static LONGEST call_dummy_nil[] = {0};
 
   /* First see if there is already a gdbarch that can satisfy the request.  */
@@ -3496,21 +3526,16 @@ sparc_gdbarch_init (struct gdbarch_info 
     case bfd_mach_sparc_sparclite_le:
       /* 32-bit machine types: */
 
-#ifdef SPARC32_CALL_DUMMY_ON_STACK
+      /* This is no way we could ever use AT_ENTRY_POINT for call dummy
+	 on 32-bit Sparc targets.  The reason is for proper nested handling
+	 of the unimp-after-call convention used when returning structures
+	 from functions.  */
       set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_on_stack);
       set_gdbarch_call_dummy_address (gdbarch, sparc_call_dummy_address);
       set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0x30);
       set_gdbarch_call_dummy_length (gdbarch, 0x38);
       set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
       set_gdbarch_call_dummy_words (gdbarch, call_dummy_32);
-#else
-      set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_at_entry_point);
-      set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
-      set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
-      set_gdbarch_call_dummy_length (gdbarch, 0);
-      set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
-      set_gdbarch_call_dummy_words (gdbarch, call_dummy_nil);
-#endif
       set_gdbarch_call_dummy_stack_adjust (gdbarch, 68);
       set_gdbarch_call_dummy_start_offset (gdbarch, 0);
       set_gdbarch_frame_args_skip (gdbarch, 68);
@@ -3529,11 +3554,7 @@ sparc_gdbarch_init (struct gdbarch_info 
       set_gdbarch_register_virtual_size (gdbarch, sparc32_register_size);
       set_gdbarch_register_virtual_type (gdbarch, 
 					 sparc32_register_virtual_type);
-#ifdef SPARC32_CALL_DUMMY_ON_STACK
       set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (call_dummy_32));
-#else
-      set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
-#endif
       set_gdbarch_stack_align (gdbarch, sparc32_stack_align);
       set_gdbarch_store_struct_return (gdbarch, sparc32_store_struct_return);
       set_gdbarch_use_struct_convention (gdbarch, 
@@ -3551,15 +3572,6 @@ sparc_gdbarch_init (struct gdbarch_info 
       /* 64-bit machine types: */
     default:	/* Any new machine type is likely to be 64-bit.  */
 
-#ifdef SPARC64_CALL_DUMMY_ON_STACK
-      set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_on_stack);
-      set_gdbarch_call_dummy_address (gdbarch, sparc_call_dummy_address);
-      set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 8 * 4);
-      set_gdbarch_call_dummy_length (gdbarch, 192);
-      set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
-      set_gdbarch_call_dummy_start_offset (gdbarch, 148);
-      set_gdbarch_call_dummy_words (gdbarch, call_dummy_64);
-#else
       set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_at_entry_point);
       set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
       set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
@@ -3567,9 +3579,10 @@ sparc_gdbarch_init (struct gdbarch_info 
       set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
       set_gdbarch_call_dummy_start_offset (gdbarch, 0);
       set_gdbarch_call_dummy_words (gdbarch, call_dummy_nil);
-#endif
       set_gdbarch_call_dummy_stack_adjust (gdbarch, 128);
-      set_gdbarch_frame_args_skip (gdbarch, 136);
+      set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
+
+      set_gdbarch_frame_args_skip (gdbarch, 128);
       set_gdbarch_function_start_offset (gdbarch, 0);
       set_gdbarch_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
       set_gdbarch_npc_regnum (gdbarch, SPARC64_NPC_REGNUM);
@@ -3587,11 +3600,6 @@ sparc_gdbarch_init (struct gdbarch_info 
       set_gdbarch_register_virtual_size (gdbarch, sparc64_register_size);
       set_gdbarch_register_virtual_type (gdbarch, 
 					 sparc64_register_virtual_type);
-#ifdef SPARC64_CALL_DUMMY_ON_STACK
-      set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (call_dummy_64));
-#else
-      set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
-#endif
       set_gdbarch_stack_align (gdbarch, sparc64_stack_align);
       set_gdbarch_store_struct_return (gdbarch, sparc64_store_struct_return);
       set_gdbarch_use_struct_convention (gdbarch, 
@@ -3602,7 +3610,7 @@ sparc_gdbarch_init (struct gdbarch_info 
       tdep->fp_max_regnum = SPARC_FP0_REGNUM + 48;
       tdep->intreg_size = 8;
       tdep->reg_save_offset = 0x90;
-      tdep->call_dummy_call_offset = 148 + 4 * 5;
+      tdep->call_dummy_call_offset = 0x0;
       break;
     }
 



More information about the Gdb-patches mailing list