From: dave.martin@linaro.org (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 0/2] ARM: assembler: Add uniform assembler framework
Date: Tue, 28 Feb 2012 18:59:44 +0000 [thread overview]
Message-ID: <1330455586-10353-1-git-send-email-dave.martin@linaro.org> (raw)
Currently, we have two substantially different dialects of assembly
language in arch/arm/ -- assmbler for .S files (with macros and
definitions from <asm/assembler.h>) and inline asm in .c files
(with macros and definitions from a variety of other places).
There is often a need to define macros to work around missing or
broken assembler features, abstract architectural features and
enable various magical build-time transformations. Unfortunately,
such macros often have to be implemented twice, since macros that
work for inline asm often don't work (or are sometimes not easily
implementable) for .S files, and vice-versa.
The first patch in this series makes <asm/assembler.h> a viable
place for common declarations to be passed to the assembler, and
also paves the way for splitting out extra declarations which are
not relevant everywhere into separate headers.
The second patch demonstrated how all this might be used in
practice (and is also likely to be needed by the kvm and Xen guys,
based on previous discussion).
To achieve all this, a script arch/arm/tools/asm-header.pl is now
run by the archprepare target, to preprocess
arch/arm/include/asm/*.h.asm. In these special headers, blocks of
native assembler declarations are transformed as shown below.
Macros defined in such blocks get transformed into something that
is includable in .c or .S files, with the desired effect:
arch/arm/include/asm/some_header.h.asm:
ASM(
stuff
for
the
assembler
)
--- becomes --->
include/generated/asm-some_header.h:
#ifdef __ASSEMBLY__
stuff
for
the
assembler
#else
asm("stuff");
asm("for");
asm("the");
asm("assembler");
#endif
Of course, there may be other, nicer ways of achieving all this...
Comments appreciated.
Cheers
---Dave
Dave Martin (2):
ARM: assembler: Add uniform assembler framework
ARM: virt: Add assembler helpers for the Virtualization Extensions
arch/arm/Makefile | 8 +-
arch/arm/include/asm/arch-virt.h | 1 +
arch/arm/include/asm/arch-virt.h.asm | 104 +++++++++++
arch/arm/include/asm/assembler.h | 322 +---------------------------------
arch/arm/include/asm/assembler.h.asm | 323 ++++++++++++++++++++++++++++++++++
arch/arm/include/asm/opcodes.h | 80 +--------
arch/arm/include/asm/opcodes.h.asm | 191 ++++++++++++++++++++
arch/arm/tools/Makefile | 4 +
arch/arm/tools/asm-header.pl | 76 ++++++++
9 files changed, 708 insertions(+), 401 deletions(-)
create mode 100644 arch/arm/include/asm/arch-virt.h
create mode 100644 arch/arm/include/asm/arch-virt.h.asm
create mode 100644 arch/arm/include/asm/assembler.h.asm
create mode 100644 arch/arm/include/asm/opcodes.h.asm
create mode 100644 arch/arm/tools/asm-header.pl
--
1.7.4.1
next reply other threads:[~2012-02-28 18:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-28 18:59 Dave Martin [this message]
2012-02-28 18:59 ` [RFC PATCH 1/2] ARM: assembler: Add uniform assembler framework Dave Martin
2012-02-28 18:59 ` [RFC PATCH 2/2] ARM: virt: Add assembler helpers for the Virtualization Extensions Dave Martin
2012-02-28 19:24 ` [RFC PATCH 0/2] ARM: assembler: Add uniform assembler framework Russell King - ARM Linux
2012-02-28 19:44 ` Dave Martin
2012-02-29 19:28 ` Dave Martin
2012-03-01 11:49 ` Dave Martin
2012-03-01 13:00 ` Russell King - ARM Linux
2012-03-01 13:20 ` Dave Martin
2012-03-02 21:42 ` Nicolas Pitre
2012-03-02 21:40 ` Nicolas Pitre
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=1330455586-10353-1-git-send-email-dave.martin@linaro.org \
--to=dave.martin@linaro.org \
--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).