Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.4:ARM
xen.17121
5dbafbfd-Arm32-entry-fold-SAVE_ALL-into-vector-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 5dbafbfd-Arm32-entry-fold-SAVE_ALL-into-vector-macro.patch of Package xen.17121
# Commit a7b81b021ead23bffb5affcac05edfc0a84d129d # Date 2019-10-31 16:21:33 +0100 # Author Julien Grall <julien.grall@arm.com> # Committer Jan Beulich <jbeulich@suse.com> 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@arm.com> Signed-off-by: Julien Grall <julien.grall@arm.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Reviewed-by: Andre Przywara <andre.przywara@arm.com> --- a/xen/arch/arm/arm32/entry.S +++ b/xen/arch/arm/arm32/entry.S @@ -12,27 +12,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 /* @@ -51,7 +30,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) @@ -130,7 +109,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
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor