public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
From: "Joseph S. Myers" <joseph@codesourcery.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: <libc-ports@sourceware.org>
Subject: Re: Miscellaneous ColdFire patches
Date: Fri, 28 Jun 2013 20:15:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.64.1306282014320.15167@digraph.polyomino.org.uk> (raw)
In-Reply-To: <87obaqgjlq.fsf@igel.home>

On Fri, 28 Jun 2013, Andreas Schwab wrote:

> There should be no need to even allocate the stack space.

Here is a revised patch which avoids the stack allocation in this
case, using new macros FMOVE and FPSPACE to abstract the differences
between classic m68k, ColdFire with FPU, and ColdFire without FPU.
Again, completely untested.

2013-06-28  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/m68k/dl-trampoline.S (FMOVE): Define conditional on
	[__mcoldfire__] and [__mcffpu__].
	(FPSPACE): Likewise.
	(_dl_runtime_profile): Save and restore %fp0 with FMOVE, only if
	[FMOVE].  Use FPSPACE in stack offsets.

diff --git a/ports/sysdeps/m68k/dl-trampoline.S b/ports/sysdeps/m68k/dl-trampoline.S
index 5aeafc7..a4caa67 100644
--- a/ports/sysdeps/m68k/dl-trampoline.S
+++ b/ports/sysdeps/m68k/dl-trampoline.S
@@ -18,6 +18,16 @@
 
 #include <sysdep.h>
 
+#if !defined (__mcoldfire__)
+# define FMOVE		fmove.x
+# define FPSPACE	12
+#elif defined (__mcffpu__)
+# define FMOVE		fmove.d
+# define FPSPACE	8
+#else
+# define FPSPACE	0
+#endif
+
 	.text
 	.globl _dl_runtime_resolve
 	.type _dl_runtime_resolve, @function
@@ -174,12 +184,9 @@ _dl_runtime_profile:
 	    +4      %a1
 	   %sp      %a0
 	*/
-#ifdef __mcoldfire__
-	fmove.d %fp0, -(%sp)
-	cfi_adjust_cfa_offset (8)
-#else
-	fmove.x %fp0, -(%sp)
-	cfi_adjust_cfa_offset (12)
+#ifdef FMOVE
+	FMOVE %fp0, -(%sp)
+	cfi_adjust_cfa_offset (FPSPACE)
 #endif
 	move.l %a0, -(%sp)
 	cfi_adjust_cfa_offset (4)
@@ -189,21 +196,12 @@ _dl_runtime_profile:
 	cfi_adjust_cfa_offset (4)
 	pea (%sp)
 	cfi_adjust_cfa_offset (4)
-#ifdef __mcoldfire__
-	pea 24(%sp)
-	cfi_adjust_cfa_offset (4)
-	move.l 40(%sp), -(%sp)
+	pea (16+FPSPACE)(%sp)
 	cfi_adjust_cfa_offset (4)
-	move.l 40(%sp), -(%sp)
+	move.l (32+FPSPACE)(%sp), -(%sp)
 	cfi_adjust_cfa_offset (4)
-#else
-	pea 28(%sp)
-	cfi_adjust_cfa_offset (4)
-	move.l 44(%sp), -(%sp)
+	move.l (32+FPSPACE)(%sp), -(%sp)
 	cfi_adjust_cfa_offset (4)
-	move.l 44(%sp), -(%sp)
-	cfi_adjust_cfa_offset (4)
-#endif
 	jbsr _dl_call_pltexit
 	lea 16(%sp), %sp
 	cfi_adjust_cfa_offset (-16)
@@ -213,12 +211,9 @@ _dl_runtime_profile:
 	cfi_adjust_cfa_offset (-4)
 	move.l (%sp)+, %a0
 	cfi_adjust_cfa_offset (-4)
-#ifdef __mcoldfire__
-	fmove.d (%sp)+, %fp0
-	cfi_adjust_cfa_offset (-8)
-#else
-	fmove.x (%sp)+, %fp0
-	cfi_adjust_cfa_offset (-12)
+#ifdef FMOVE
+	FMOVE (%sp)+, %fp0
+	cfi_adjust_cfa_offset (-FPSPACE)
 #endif
 	lea 20(%sp), %sp
 	cfi_adjust_cfa_offset (-20)


-- 
Joseph S. Myers
joseph@codesourcery.com

  reply	other threads:[~2013-06-28 20:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-28 16:00 Joseph S. Myers
2013-06-28 18:45 ` Andreas Schwab
2013-06-28 20:15   ` Joseph S. Myers [this message]
2013-06-30 20:57     ` Andreas Schwab
2013-06-28 20:25   ` Joseph S. Myers
2013-08-20 16:48     ` Ping for m68k MMAP2_PAGE_SHIFT fix Joseph S. Myers
2013-08-20 18:49       ` Andreas Schwab
2013-09-02 15:17       ` Ping " Joseph S. Myers
2013-09-04 20:44     ` Miscellaneous ColdFire patches Andreas Schwab
2013-06-28 20:32   ` Joseph S. Myers

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=Pine.LNX.4.64.1306282014320.15167@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=libc-ports@sourceware.org \
    --cc=schwab@linux-m68k.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).