Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] Fix sparc64 pop/push frame reg saving
Date: Sat, 20 Apr 2002 01:47:00 -0000	[thread overview]
Message-ID: <20020420.013839.70807514.davem@redhat.com> (raw)


This makes sure that all the correct regs get saved
in push/pop regs on sparc64.

		sparc32			sparc64
failures before	83			111
failures after	83			110

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

	* sparc-tdep.c (sparc_push_dummy_frame): Save Y, PC, NPC, CCR, FSR
	properly on sparc64.
	(sparc_push_dummy_frame): Find them in the right spot.
	(sparc_pop_frame): Restore them properly.

--- sparc-tdep.c.~1~	Fri Apr 19 23:53:57 2002
+++ sparc-tdep.c	Sat Apr 20 00:34:53 2002
@@ -960,13 +960,10 @@ sparc_push_dummy_frame (void)
 
   if (GDB_TARGET_IS_SPARC64)
     {
-      /* PC, NPC, CCR, FSR, FPRS, Y, ASI */
-      read_register_bytes (REGISTER_BYTE (PC_REGNUM), &register_temp[0],
-			   REGISTER_RAW_SIZE (PC_REGNUM) * 7);
-      read_register_bytes (REGISTER_BYTE (PSTATE_REGNUM), 
-			   &register_temp[7 * SPARC_INTREG_SIZE],
-			   REGISTER_RAW_SIZE (PSTATE_REGNUM));
-      /* FIXME: not sure what needs to be saved here.  */
+      /* Y, PC, NPC, CCR, FSR */
+      read_register_bytes (REGISTER_BYTE (Y_REGNUM),
+			   &register_temp[0],
+			   REGISTER_RAW_SIZE (Y_REGNUM) * 5);
     }
   else
     {
@@ -1111,14 +1108,10 @@ sparc_frame_find_saved_regs (struct fram
 
       if (GDB_TARGET_IS_SPARC64)
 	{
-	  for (regnum = PC_REGNUM; regnum < PC_REGNUM + 7; regnum++)
-	    {
-	      saved_regs_addr[regnum] =
-		frame_addr + (regnum - PC_REGNUM) * SPARC_INTREG_SIZE
-		- DUMMY_STACK_REG_BUF_SIZE;
-	    }
-	  saved_regs_addr[PSTATE_REGNUM] =
-	    frame_addr + 8 * SPARC_INTREG_SIZE - DUMMY_STACK_REG_BUF_SIZE;
+	  for (regnum = Y_REGNUM; regnum <= FSR_REGNUM; regnum++)
+	    saved_regs_addr[regnum] =
+	      frame_addr + (regnum - Y_REGNUM) * SPARC_INTREG_SIZE
+	      - DUMMY_STACK_REG_BUF_SIZE;
 	}
       else
 	for (regnum = Y_REGNUM; regnum < NUM_REGS; regnum++)
@@ -1173,7 +1166,6 @@ sparc_frame_find_saved_regs (struct fram
 	}
     }
   /* Otherwise, whatever we would get from ptrace(GETREGS) is accurate */
-  /* FIXME -- should this adjust for the sparc64 offset? */
   saved_regs_addr[SP_REGNUM] = FRAME_FP (fi);
 }
 
@@ -1224,6 +1216,14 @@ sparc_pop_frame (void)
 	      write_register_gen (CPS_REGNUM, raw_buffer);
 	    }
 	}
+      else
+	{
+	  if (fsr[FSR_REGNUM])
+	    {
+	      read_memory (fsr[FSR_REGNUM], raw_buffer, SPARC_INTREG_SIZE);
+	      write_register_gen (FSR_REGNUM, raw_buffer);
+	    }
+	}
     }
   if (fsr[G1_REGNUM])
     {
@@ -1289,10 +1289,19 @@ sparc_pop_frame (void)
     }
 
   if (!(GDB_TARGET_IS_SPARC64))
-    if (fsr[PS_REGNUM])
-      write_register (PS_REGNUM, 
-		      read_memory_integer (fsr[PS_REGNUM], 
-					   REGISTER_RAW_SIZE (PS_REGNUM)));
+    {
+      if (fsr[PS_REGNUM])
+	write_register (PS_REGNUM,
+			read_memory_integer (fsr[PS_REGNUM],
+					     REGISTER_RAW_SIZE (PS_REGNUM)));
+    }
+  else
+    {
+      if (fsr[CCR_REGNUM])
+	write_register (CCR_REGNUM,
+			read_memory_integer (fsr[CCR_REGNUM],
+					     REGISTER_RAW_SIZE (CCR_REGNUM)));
+    }
 
   if (fsr[Y_REGNUM])
     write_register (Y_REGNUM, 


             reply	other threads:[~2002-04-20  8:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-20  1:47 David S. Miller [this message]
2002-04-23 12:45 ` Michael Snyder
2002-04-23 18:20   ` Andrew Cagney
2002-04-23 21:55   ` David S. Miller
2002-04-24 11:26     ` Michael Snyder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020420.013839.70807514.davem@redhat.com \
    --to=davem@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox