[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging-4.12] xen/arm32: entry: Fold the macro SAVE_ALL in the macro vector
commit 58d59b918e1873fafff6a885c2622fc7a3eb212a Author: Julien Grall <julien.grall@xxxxxxx> AuthorDate: Thu Oct 31 16:58:12 2019 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Thu Oct 31 16:58:12 2019 +0100 xen/arm32: entry: Fold the macro SAVE_ALL in the macro vector Follow-up rework will require the macro vector to distinguish between a trap from a guest vs while in the hypervisor. The macro SAVE_ALL already has code to distinguish between the two and it is only called by the vector macro. So fold the former into the latter. This will help to avoid duplicating the check. This is part of XSA-303. Reported-by: Julien Grall <Julien.Grall@xxxxxxx> Signed-off-by: Julien Grall <julien.grall@xxxxxxx> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx> Reviewed-by: Andre Przywara <andre.przywara@xxxxxxx> master commit: a7b81b021ead23bffb5affcac05edfc0a84d129d master date: 2019-10-31 16:21:33 +0100 --- xen/arch/arm/arm32/entry.S | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/xen/arch/arm/arm32/entry.S b/xen/arch/arm/arm32/entry.S index 4a762e04f1..150cbc0b4b 100644 --- a/xen/arch/arm/arm32/entry.S +++ b/xen/arch/arm/arm32/entry.S @@ -13,27 +13,6 @@ #define RESTORE_BANKED(mode) \ RESTORE_ONE_BANKED(SP_##mode) ; RESTORE_ONE_BANKED(LR_##mode) ; RESTORE_ONE_BANKED(SPSR_##mode) -#define SAVE_ALL \ - sub sp, #(UREGS_SP_usr - UREGS_sp); /* SP, LR, SPSR, PC */ \ - push {r0-r12}; /* Save R0-R12 */ \ - \ - mrs r11, ELR_hyp; /* ELR_hyp is return address. */\ - str r11, [sp, #UREGS_pc]; \ - \ - str lr, [sp, #UREGS_lr]; \ - \ - add r11, sp, #UREGS_kernel_sizeof+4; \ - str r11, [sp, #UREGS_sp]; \ - \ - mrc CP32(r11, HSR); /* Save exception syndrome */ \ - str r11, [sp, #UREGS_hsr]; \ - \ - mrs r11, SPSR_hyp; \ - str r11, [sp, #UREGS_cpsr]; \ - and r11, #PSR_MODE_MASK; \ - cmp r11, #PSR_MODE_HYP; \ - blne save_guest_regs - save_guest_regs: #ifdef CONFIG_ARM32_HARDEN_BRANCH_PREDICTOR /* @@ -52,7 +31,7 @@ save_guest_regs: ldr r11, =0xffffffff /* Clobber SP which is only valid for hypervisor frames. */ str r11, [sp, #UREGS_sp] SAVE_ONE_BANKED(SP_usr) - /* LR_usr is the same physical register as lr and is saved in SAVE_ALL */ + /* LR_usr is the same physical register as lr and is saved by the caller */ SAVE_BANKED(svc) SAVE_BANKED(abt) SAVE_BANKED(und) @@ -131,7 +110,28 @@ skip_check: * interrupts (Asynchronous Abort, IRQ, FIQ) to unmask. */ .macro vector trap, iflags - SAVE_ALL + /* Save registers in the stack */ + sub sp, #(UREGS_SP_usr - UREGS_sp) /* SP, LR, SPSR, PC */ + push {r0-r12} /* Save R0-R12 */ + mrs r11, ELR_hyp /* ELR_hyp is return address */ + str r11, [sp, #UREGS_pc] + + str lr, [sp, #UREGS_lr] + + add r11, sp, #(UREGS_kernel_sizeof + 4) + + str r11, [sp, #UREGS_sp] + + mrc CP32(r11, HSR) /* Save exception syndrome */ + str r11, [sp, #UREGS_hsr] + + mrs r11, SPSR_hyp + str r11, [sp, #UREGS_cpsr] + and r11, #PSR_MODE_MASK + cmp r11, #PSR_MODE_HYP + blne save_guest_regs + + /* We are ready to handle the trap, setup the registers and jump. */ cpsie \iflags adr lr, return_from_trap mov r0, sp -- generated by git-patchbot for /home/xen/git/xen.git#staging-4.12 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |