]> git.karo-electronics.de Git - karo-tx-linux.git/commit
ARM: 7509/1: opcodes: Make opcode byteswapping macros assembly-compatible
authorDave Martin <dave.martin@linaro.org>
Mon, 3 Sep 2012 12:49:23 +0000 (13:49 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 15 Sep 2012 20:25:54 +0000 (21:25 +0100)
commit0ce3de23f2a520a6ac8c2179fb8f88342c4992ef
tree6d0de0020f06db07230e32b20ef3302293be8fbb
parent57b9da32addd819b0baef5573a88fcfaf3e6699b
ARM: 7509/1: opcodes: Make opcode byteswapping macros assembly-compatible

Most of the existing macros don't work with assembler, due to the
use of type casts and C functions from <linux/swab.h>.

This patch abstracts out those operations and provides simple
explicit versions for use in assembly code.

__opcode_is_thumb32() and __opcode_is_thumb16() are also converted
to do bitmask-based testing to avoid confusion if these are used in
assembly code (the assembler typically treats all arithmetic values
as signed).

These changes avoid the need for the compiler to pre-evaluate
constant expressions used to generate opcodes.  By ensuring that
the forms of these expressions can be evaluated directly by the
assembler, we can just stringify the expressions directly into the
asm during the preprocessing pass.  The alternative approach
(passing the evaluated expression via an inline asm "i" constraint)
gets painful because the contents of the asm and the constraints
must be kept in sync.  This makes the resulting macros awkward to
use.

Retaining the C forms of the macros allows more efficient code to
be generated when opcodes are generated programmatically at run-
time, but there is no way to embed run-time-generated opcodes in
asm() blocks.

Signed-off-by: Dave Martin <dave.martin@linaro.org>
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/include/asm/opcodes.h