[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging-4.8] xen/arm32: entry: Consolidate DEFINE_TRAP_ENTRY*() macros
commit d02aeba1b36fadd3757d2d6f2bb2ba3b0b7634f0 Author: Julien Grall <julien.grall@xxxxxxx> AuthorDate: Tue Oct 1 13:07:53 2019 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Mon Nov 4 15:20:29 2019 +0100 xen/arm32: entry: Consolidate DEFINE_TRAP_ENTRY*() macros The only difference between the two macros DEFINE_TRAP_ENTRY() and DEFINE_TRAP_ENTRY_NOIRQ() is the list of interrupts to be unmasked. While the macros are fairly small today, it will be necessary to add the same code twice in follow-up patches. To prevent too much duplication, a new assembly macros is introduced to generate the body of a trap. This is part of XSA-303. Reported-by: Julien Grall <Julien.Grall@xxxxxxx> Signed-off-by: Julien Grall <julien.grall@xxxxxxx> Acked-by: Stefano Stabellini <sstabellini@xxxxxxxxxx> --- xen/arch/arm/arm32/entry.S | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/xen/arch/arm/arm32/entry.S b/xen/arch/arm/arm32/entry.S index 3e320dc8ac..f6ba5a2082 100644 --- a/xen/arch/arm/arm32/entry.S +++ b/xen/arch/arm/arm32/entry.S @@ -116,30 +116,37 @@ abort_guest_exit_end: mov pc, lr + + /* + * Macro to define a trap entry. The iflags is optional and + * corresponds to alist of interrupts (Asynchronous Abort, IRQ, FIQ) + * to unmask. + */ + .macro vector trap, iflags=n + SAVE_ALL + .if \iflags != n + cpsie \iflags + .endif + adr lr, return_from_trap + mov r0, sp + /* + * Save the stack pointer in r11. It will be restored after the + * trap has been handled (see return_from_trap). + */ + mov r11, sp + bic sp, #7 /* Align the stack pointer (noop on guest trap) */ + b do_trap_\trap + .endm + #define DEFINE_TRAP_ENTRY(trap) \ ALIGN; \ trap_##trap: \ - SAVE_ALL; \ - cpsie i; /* local_irq_enable */ \ - adr lr, return_from_trap; \ - mov r0, sp; \ - /* \ - * Save the stack pointer in r11. It will be restored after the \ - * trap has been handled (see return_from_trap). \ - */ \ - mov r11, sp; \ - bic sp, #7; /* Align the stack pointer (noop on guest trap) */ \ - b do_trap_##trap + vector trap, iflags=i \ #define DEFINE_TRAP_ENTRY_NOIRQ(trap) \ ALIGN; \ trap_##trap: \ - SAVE_ALL; \ - adr lr, return_from_trap; \ - mov r0, sp; \ - mov r11, sp; \ - bic sp, #7; /* Align the stack pointer (noop on guest trap) */ \ - b do_trap_##trap + vector trap .align 5 GLOBAL(hyp_traps_vector) -- generated by git-patchbot for /home/xen/git/xen.git#staging-4.8 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |