All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxim Kuvyrkov <maxim@codesourcery.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Andreas Schwab <schwab@linux-m68k.org>,
	Greg Ungerer <gerg@snapgear.com>,
	Linux/m68k <linux-m68k@vger.kernel.org>
Subject: Re: [PATCH] Define sigcontext ABI for ColdFire
Date: Tue, 09 Feb 2010 14:22:33 +0300	[thread overview]
Message-ID: <4B714579.3060508@codesourcery.com> (raw)
In-Reply-To: <4AB9439B.6050006@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 767 bytes --]

On 9/23/09 1:37 AM, Maxim Kuvyrkov wrote:
> Maxim Kuvyrkov wrote:
>> The following patch define sigcontext ABI of ColdFire.
...
> I was lured into thinking that the above sequence is OK by m68knommu's
> version of the trampoline. Arch/m68knommu/kernel/entry.S uses "move
> #__NR_rt_sigreturn,%d0" which assembles into "move.w". This is too is
> buggy and I'm also attaching the fix for the nommu version.

I have cleaned up the sigcontext patch for ColdFire to only touch the 
necessary fields in the sigcontext structure.  Attached are the cleaned 
up sigcontext patch and the rt_sigreturn fix for m68knommu.

I hope these patches will find their way into m68k/for-2.6.34 branch.

Regards,

-- 
Maxim Kuvyrkov
CodeSourcery
maxim@codesourcery.com
(650) 331-3385 x724

[-- Attachment #2: 0001-Define-sigcontext-ABI-for-ColdFire.patch --]
[-- Type: text/plain, Size: 2571 bytes --]

>From 1630ef86e8a1239c1d4ec6f8a6566ab57771f615 Mon Sep 17 00:00:00 2001
From: Maxim Kuvyrkov <maxim@codesourcery.com>
Date: Tue, 9 Feb 2010 14:03:16 +0300
Subject: [PATCH 1/2] Define sigcontext ABI for ColdFire

The following patch defines sigcontext ABI of ColdFire.  Due to ISA
restrictions ColdFire needs different rt_sigreturn trampoline.  And
due to ColdFire FPU registers being 8-bytes instead of 12-bytes,
sigcontext and fpregset structures need to be updated.

Signed-off-by: Maxim Kuvyrkov <maxim@codesourcery.com>
---
 arch/m68k/include/asm/sigcontext.h |    4 ++++
 arch/m68k/include/asm/ucontext.h   |    4 ++++
 arch/m68k/kernel/signal.c          |    7 +++++++
 3 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/m68k/include/asm/sigcontext.h b/arch/m68k/include/asm/sigcontext.h
index 523db2a..68d8881 100644
--- a/arch/m68k/include/asm/sigcontext.h
+++ b/arch/m68k/include/asm/sigcontext.h
@@ -15,7 +15,11 @@ struct sigcontext {
 	unsigned long  sc_pc;
 	unsigned short sc_formatvec;
 #ifndef __uClinux__
+# ifndef __mcoldfire__
 	unsigned long  sc_fpregs[2*3];  /* room for two fp registers */
+# else
+	unsigned long  sc_fpregs[2][2];	/* room for two fp registers */
+# endif
 	unsigned long  sc_fpcntl[3];
 	unsigned char  sc_fpstate[216];
 #endif
diff --git a/arch/m68k/include/asm/ucontext.h b/arch/m68k/include/asm/ucontext.h
index e4e2266..465062b 100644
--- a/arch/m68k/include/asm/ucontext.h
+++ b/arch/m68k/include/asm/ucontext.h
@@ -7,7 +7,11 @@ typedef greg_t gregset_t[NGREG];
 
 typedef struct fpregset {
 	int f_fpcntl[3];
+#ifndef __mcoldfire__
 	int f_fpregs[8*3];
+#else
+	int f_fpregs[8][2];
+#endif
 } fpregset_t;
 
 struct mcontext {
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
index de2d05d..3be91e1 100644
--- a/arch/m68k/kernel/signal.c
+++ b/arch/m68k/kernel/signal.c
@@ -897,10 +897,17 @@ static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
 
 	/* Set up to return from userspace.  */
 	err |= __put_user(frame->retcode, &frame->pretcode);
+#ifndef __mcoldfire__
 	/* moveq #,d0; notb d0; trap #0 */
 	err |= __put_user(0x70004600 + ((__NR_rt_sigreturn ^ 0xff) << 16),
 			  (long __user *)(frame->retcode + 0));
 	err |= __put_user(0x4e40, (short __user *)(frame->retcode + 4));
+#else
+	/* movel #__NR_rt_sigreturn,d0; trap #0 */
+	err |= __put_user(0x203c0000, (long __user *)(frame->retcode + 0));
+	err |= __put_user(0x00004e40 + (__NR_rt_sigreturn << 16),
+			  (long __user *)(frame->retcode + 4));
+#endif
 
 	if (err)
 		goto give_sigsegv;
-- 
1.6.6.1


[-- Attachment #3: 0002-Fix-m68k-uclinux-s-rt_sigreturn-trampoline.patch --]
[-- Type: text/plain, Size: 727 bytes --]

>From 68c601c6f0135ca7cede22d4b1d4f59ef545f965 Mon Sep 17 00:00:00 2001
From: Maxim Kuvyrkov <maxim@codesourcery.com>
Date: Wed, 23 Sep 2009 01:25:44 +0400
Subject: [PATCH 2/2] Fix m68k-uclinux's rt_sigreturn trampoline

Signed-off-by: Maxim Kuvyrkov <maxim@codesourcery.com>
---
 arch/m68knommu/kernel/entry.S |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/m68knommu/kernel/entry.S b/arch/m68knommu/kernel/entry.S
index 56043ad..aff6f57 100644
--- a/arch/m68knommu/kernel/entry.S
+++ b/arch/m68knommu/kernel/entry.S
@@ -145,6 +145,6 @@ ENTRY(ret_from_user_signal)
 	trap #0
 
 ENTRY(ret_from_user_rt_signal)
-	move #__NR_rt_sigreturn,%d0
+	movel #__NR_rt_sigreturn,%d0
 	trap #0
 
-- 
1.6.6.1


  parent reply	other threads:[~2010-02-09 11:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-18 10:28 [PATCH] Define sigcontext ABI of ColdFire Maxim Kuvyrkov
2009-09-22 21:37 ` Maxim Kuvyrkov
2009-11-09  9:42   ` Maxim Kuvyrkov
2010-02-09 11:22   ` Maxim Kuvyrkov [this message]
2010-02-10  6:16     ` [PATCH] Define sigcontext ABI for ColdFire Greg Ungerer

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=4B714579.3060508@codesourcery.com \
    --to=maxim@codesourcery.com \
    --cc=geert@linux-m68k.org \
    --cc=gerg@snapgear.com \
    --cc=linux-m68k@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.