From: imre.deak@nokia.com (Imre Deak)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH v5 0/2] ARM: VFP: Save / restore VFP state on the signal handler path
Date: Tue, 13 Apr 2010 14:42:18 +0300 [thread overview]
Message-ID: <20100413114218.GA22424@localhost> (raw)
In-Reply-To: <20100412220440.GF6148@shareable.org>
On Tue, Apr 13, 2010 at 12:04:40AM +0200, ext Jamie Lokier wrote:
> imre.deak at nokia.com wrote:
> > From: Imre Deak <imre.deak@nokia.com>
> >
> > Changes since v4:
> > - Do not add the packed attribute to user_vfp or user_vfp_exc.
> > I added packed to these structs to prevent the extra padding in
> > vfp_sigframe. But actually the padding is in accordance with the
> > ARM ABI.
>
> EABI, OABI or both?
I checked only EABI, which specifies alignment to the struct's alignment,
which is 8 bytes for struct user_vfp.
I haven't found an official OABI spec, but some googling turned up
that there the requirement is only to align to word size, so we'd
have a difference in the struct vfp_sigframe's size and the alignment
of the user_vfp_exc within.
> In general it's a really good idea, if you know there will be padding,
> to insert dummy fields where the padding goes so that it doesn't make
> any difference what compiler, ABI and settings are used.
Ok. If I understand correctly this is needed for kernels with support
for both OABI and EABI.
There is implicit alignment in struct user_vfp and struct user_vfp_exc.
I can fix up user_vfp_exc since it's new and not used by anyone, but
user_vfp is used by ptrace. I don't see a problem adding the padding to
it either since the kernel ever accesses it on a field-by-field basis,
but for kernels built with an OABI compiler this would mean an increase
in the struct's size. If this is not a problem I'd follow up with a 2/2
patch according to the following.
Please let me know if it's ok with you.
--Imre
--- a/arch/arm/include/asm/ucontext.h
+++ b/arch/arm/include/asm/ucontext.h
@@ -59,23 +59,19 @@ struct iwmmxt_sigframe {
#endif /* CONFIG_IWMMXT */
#ifdef CONFIG_VFP
-#if __LINUX_ARM_ARCH__ < 6
-/* For ARM pre-v6, we use fstmiax and fldmiax. This adds one extra
- * word after the registers, and a word of padding@the end for
- * alignment. */
#define VFP_MAGIC 0x56465001
-#define VFP_STORAGE_SIZE 152
-#else
-#define VFP_MAGIC 0x56465002
-#define VFP_STORAGE_SIZE 144
-#endif
struct vfp_sigframe
{
unsigned long magic;
unsigned long size;
- union vfp_state storage;
-};
+ struct user_vfp ufp;
+ struct user_vfp_exc ufp_exc;
+} __attribute__((__aligned__(8)));
+
+/* 8 bytes for magic and size, 264 bytes for ufp, 16 bytes for ufp_exc. */
+#define VFP_STORAGE_SIZE sizeof(struct vfp_sigframe)
+
#endif /* CONFIG_VFP */
/*
@@ -91,7 +87,7 @@ struct aux_sigframe {
#ifdef CONFIG_IWMMXT
struct iwmmxt_sigframe iwmmxt;
#endif
-#if 0 && defined CONFIG_VFP /* Not yet saved. */
+#ifdef CONFIG_VFP
struct vfp_sigframe vfp;
#endif
/* Something that isn't a valid magic number for any coprocessor. */
diff --git a/arch/arm/include/asm/user.h b/arch/arm/include/asm/user.h
index df95e05..07e66fa 100644
--- a/arch/arm/include/asm/user.h
+++ b/arch/arm/include/asm/user.h
@@ -83,11 +83,23 @@ struct user{
/*
* User specific VFP registers. If only VFPv2 is present, registers 16 to 31
- * are ignored by the ptrace system call.
+ * are ignored by the ptrace system call and the signal handler.
*/
struct user_vfp {
unsigned long long fpregs[32];
unsigned long fpscr;
+ unsigned long pad;
+};
+
+/*
+ * VFP exception registers exposed to user space during signal delivery.
+ * Fields not relavant to the current VFP architecture are ignored.
+ */
+struct user_vfp_exc {
+ unsigned long fpexc;
+ unsigned long fpinst;
+ unsigned long fpinst2;
+ unsigned long pad;
};
#endif /* _ARM_USER_H */
next prev parent reply other threads:[~2010-04-13 11:42 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1242744292-23776-1-git-send-email-imre.deak@nokia.com>
2010-02-04 21:37 ` [RFC PATCH v2 0/2] ARM: VFP: Save / restore VFP state on the signal handler path Imre Deak
2010-02-04 21:38 ` [RFC PATCH v2 1/2] ARM: VFP: add support to sync the VFP state of the current thread Imre Deak
2010-02-06 10:32 ` Russell King - ARM Linux
2010-02-06 11:20 ` Russell King - ARM Linux
2010-02-06 11:32 ` Russell King - ARM Linux
2010-02-06 11:41 ` Russell King - ARM Linux
2010-02-06 15:55 ` Imre Deak
2010-02-04 21:38 ` [RFC PATCH v2 2/2] ARM: VFP: preserve the HW context when calling signal handlers Imre Deak
2010-02-06 9:25 ` Russell King - ARM Linux
2010-02-06 10:02 ` Imre Deak
2010-02-06 12:12 ` Russell King - ARM Linux
2010-02-06 16:23 ` Imre Deak
2010-03-29 16:17 ` [RFC PATCH v3 0/3] ARM: VFP: Save / restore VFP state on the signal handler path imre.deak at nokia.com
2010-03-31 21:23 ` [RFC PATCH v4 " imre.deak at nokia.com
2010-04-02 14:36 ` [RFC PATCH v5 0/2] " imre.deak at nokia.com
2010-04-02 14:36 ` [RFC PATCH v5 1/2] ARM: VFP: fix the SMP versions of vfp_{sync, flush}_hwstate imre.deak at nokia.com
2010-04-12 18:39 ` [RFC PATCH v5 1/2] ARM: VFP: fix the SMP versions of vfp_{sync,flush}_hwstate Russell King - ARM Linux
2010-04-02 14:36 ` [RFC PATCH v5 2/2] ARM: VFP: preserve the HW context when calling signal handlers imre.deak at nokia.com
2010-04-12 18:41 ` Russell King - ARM Linux
2010-04-12 22:04 ` [RFC PATCH v5 0/2] ARM: VFP: Save / restore VFP state on the signal handler path Jamie Lokier
2010-04-13 11:42 ` Imre Deak [this message]
2010-04-13 11:59 ` Nicolas Pitre
2010-04-07 16:24 ` [RFC PATCH v4 0/3] " Dirk Behme
2010-04-07 16:39 ` Imre Deak
2010-04-07 17:31 ` Jason McMullan
2010-03-31 21:23 ` [RFC PATCH v4 1/3] ARM: VFP: fix the SMP versions of vfp_{sync, flush}_hwstate imre.deak at nokia.com
2010-03-31 21:23 ` [RFC PATCH v4 2/3] ARM: VFP: make user_vfp struct packed imre.deak at nokia.com
2010-03-31 21:23 ` [RFC PATCH v4 3/3] ARM: VFP: preserve the HW context when calling signal handlers imre.deak at nokia.com
2010-03-29 16:17 ` [RFC PATCH v3 1/3] ARM: VFP: add support to sync the VFP state of the current thread imre.deak at nokia.com
2010-03-29 16:17 ` [RFC PATCH v3 2/3] ARM: VFP: make user_vfp struct packed imre.deak at nokia.com
2010-03-29 16:17 ` [RFC PATCH v3 3/3] ARM: VFP: preserve the HW context when calling signal handlers imre.deak at nokia.com
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=20100413114218.GA22424@localhost \
--to=imre.deak@nokia.com \
--cc=linux-arm-kernel@lists.infradead.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