From: Kevin Hilman <khilman@ti.com>
To: Dave Martin <dave.martin@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
Jean Pihet <j-pihet@ti.com>
Subject: Re: [PATCH v4] ARM: Thumb-2: Symbol manipulation macros for function body copying
Date: Wed, 19 Jan 2011 14:29:00 -0800 [thread overview]
Message-ID: <87bp3cr0ib.fsf@ti.com> (raw)
In-Reply-To: <1295039877-7976-1-git-send-email-dave.martin@linaro.org> (Dave Martin's message of "Fri, 14 Jan 2011 15:17:57 -0600")
Dave Martin <dave.martin@linaro.org> writes:
> In low-level board support code, there is sometimes a need to
> copy a function body to another location at run-time.
>
> A straightforward call to memcpy doesn't work in Thumb-2,
> because bit 0 of external Thumb function symbols is set to 1,
> indicating that the function is Thumb. Without corrective
> measures, this will cause an off-by-one copy, and the copy
> may be called using the wrong instruction set.
>
> This patch adds an fncpy() macro to help with such copies.
>
> Particular care is needed, because C doesn't guarantee any
> defined behaviour when casting a function pointer to any other
> type. This has been observed to lead to strange optimisation
> side-effects when doing the arithmetic which is required in
> order to copy/move function bodies correctly in Thumb-2.
>
> Thanks to Russell King and Nicolas Pitre for their input
> on this patch.
>
> Signed-off-by: Dave Martin <dave.martin@linaro.org>
> Tested-by: Jean Pihet <j-pihet@ti.com>
Tested-by: Kevin Hilman <khilman@ti.com>
along with Jean's OMAP patch on:
OMAP2420/n810: including basic suspend/resume test.
OMAP16xx/OSK: boot test only.
Kevin
WARNING: multiple messages have this Message-ID (diff)
From: khilman@ti.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4] ARM: Thumb-2: Symbol manipulation macros for function body copying
Date: Wed, 19 Jan 2011 14:29:00 -0800 [thread overview]
Message-ID: <87bp3cr0ib.fsf@ti.com> (raw)
In-Reply-To: <1295039877-7976-1-git-send-email-dave.martin@linaro.org> (Dave Martin's message of "Fri, 14 Jan 2011 15:17:57 -0600")
Dave Martin <dave.martin@linaro.org> writes:
> In low-level board support code, there is sometimes a need to
> copy a function body to another location at run-time.
>
> A straightforward call to memcpy doesn't work in Thumb-2,
> because bit 0 of external Thumb function symbols is set to 1,
> indicating that the function is Thumb. Without corrective
> measures, this will cause an off-by-one copy, and the copy
> may be called using the wrong instruction set.
>
> This patch adds an fncpy() macro to help with such copies.
>
> Particular care is needed, because C doesn't guarantee any
> defined behaviour when casting a function pointer to any other
> type. This has been observed to lead to strange optimisation
> side-effects when doing the arithmetic which is required in
> order to copy/move function bodies correctly in Thumb-2.
>
> Thanks to Russell King and Nicolas Pitre for their input
> on this patch.
>
> Signed-off-by: Dave Martin <dave.martin@linaro.org>
> Tested-by: Jean Pihet <j-pihet@ti.com>
Tested-by: Kevin Hilman <khilman@ti.com>
along with Jean's OMAP patch on:
OMAP2420/n810: including basic suspend/resume test.
OMAP16xx/OSK: boot test only.
Kevin
next prev parent reply other threads:[~2011-01-19 22:29 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-14 21:17 [PATCH v4] ARM: Thumb-2: Symbol manipulation macros for function body copying Dave Martin
2011-01-14 21:17 ` Dave Martin
2011-01-17 14:02 ` Jean Pihet
2011-01-17 14:02 ` Jean Pihet
2011-01-17 15:35 ` Dave Martin
2011-01-17 15:35 ` Dave Martin
2011-01-17 15:36 ` Santosh Shilimkar
2011-01-17 15:36 ` Santosh Shilimkar
2011-01-17 15:48 ` Jean Pihet
2011-01-17 15:48 ` Jean Pihet
2011-01-17 16:01 ` Russell King - ARM Linux
2011-01-17 16:01 ` Russell King - ARM Linux
2011-01-26 16:05 ` Dave Martin
2011-01-26 16:38 ` Russell King - ARM Linux
2011-01-26 16:57 ` Dave Martin
2011-01-19 22:09 ` Tony Lindgren
2011-01-19 22:09 ` Tony Lindgren
2011-01-19 22:29 ` Kevin Hilman [this message]
2011-01-19 22:29 ` Kevin Hilman
2011-01-20 9:42 ` Dave Martin
2011-01-20 9:42 ` Dave Martin
2011-01-24 13:50 ` Dave Martin
2011-01-24 13:50 ` Dave Martin
2011-01-24 14:07 ` Jean Pihet
2011-01-24 14:07 ` Jean Pihet
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=87bp3cr0ib.fsf@ti.com \
--to=khilman@ti.com \
--cc=dave.martin@linaro.org \
--cc=j-pihet@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.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.