linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tony@atomide.com (Tony Lindgren)
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:09:25 -0800	[thread overview]
Message-ID: <20110119220925.GF4957@atomide.com> (raw)
In-Reply-To: <1295039877-7976-1-git-send-email-dave.martin@linaro.org>

* Dave Martin <dave.martin@linaro.org> [110114 13:17]:
> 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>

Boot tested on osk5912 and n800:

Tested-by: Tony Lindgren <tony@atomide.com>

  parent reply	other threads:[~2011-01-19 22:09 UTC|newest]

Thread overview: 14+ 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-17 14:02 ` Jean Pihet
2011-01-17 15:35   ` Dave Martin
2011-01-17 15:36     ` Santosh Shilimkar
2011-01-17 15:48     ` Jean Pihet
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 [this message]
2011-01-19 22:29 ` Kevin Hilman
2011-01-20  9:42   ` Dave Martin
2011-01-24 13:50     ` Dave Martin
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=20110119220925.GF4957@atomide.com \
    --to=tony@atomide.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;
as well as URLs for NNTP newsgroup(s).