mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
ARM: Fix register constraints in run_in_exception_handler()
For asm() statements, clobbers are disjoint from inputs and outputs.
Therefore, run_in_exception_handler() specifying an input and clobbering
BUG_FN_REG forces the compiler to set up fn in the wrong regsiter, just to
have the code block move it into the correct register.
Instead, use `register asm()` to tell the compiler which register fn really
wants to be in. This results in better code generation.
Bloat-o-meter reports:
ARM64:
Function old new delta
dump_registers 356 348 -8
ARM32:
ns16550_poll 52 48 -4
dump_registers 432 428 -4
The other instruction dropped in ARM64's dump_registers() is an alignment nop.
No functional change.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
This commit is contained in:
1 parent
14acde869f
commit
1f5e64755d
1 file changed
+3
-3
@@ -59,15 +59,15 @@ struct bug_frame {
|
||||
* be called function in a fixed register.
|
||||
*/
|
||||
#define run_in_exception_handler(fn) do { \
|
||||
asm ("mov " __stringify(BUG_FN_REG) ", %0\n" \
|
||||
"1:"BUG_INSTR"\n" \
|
||||
register unsigned long _fn asm (STR(BUG_FN_REG)) = (unsigned long)(fn); \
|
||||
asm ("1:"BUG_INSTR"\n" \
|
||||
".pushsection .bug_frames." __stringify(BUGFRAME_run_fn) "," \
|
||||
" \"a\", %%progbits\n" \
|
||||
"2:\n" \
|
||||
".p2align 2\n" \
|
||||
".long (1b - 2b)\n" \
|
||||
".long 0, 0, 0\n" \
|
||||
".popsection" :: "r" (fn) : __stringify(BUG_FN_REG) ); \
|
||||
".popsection" :: "r" (_fn) ); \
|
||||
} while (0)
|
||||
|
||||
#define WARN() BUG_FRAME(BUGFRAME_warn, __LINE__, __FILE__, 0, "")
|
||||
|
||||