[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] ARM: Fix register constraints in run_in_exception_handler()
commit 1f5e64755d0e25b3aadf3c1ec1a4a0f0f3665969 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Fri Feb 7 22:27:53 2025 +0000 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Fri May 16 22:20:21 2025 +0100 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@xxxxxxxxxx> Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx> --- xen/arch/arm/include/asm/bug.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/include/asm/bug.h b/xen/arch/arm/include/asm/bug.h index cacaf014ab..8bf71587be 100644 --- a/xen/arch/arm/include/asm/bug.h +++ b/xen/arch/arm/include/asm/bug.h @@ -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, "") -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |