diff options
Diffstat (limited to 'bl31')
-rw-r--r-- | bl31/aarch64/bl31_entrypoint.S | 17 | ||||
-rw-r--r-- | bl31/aarch64/context.S | 44 | ||||
-rw-r--r-- | bl31/aarch64/runtime_exceptions.S | 4 | ||||
-rw-r--r-- | bl31/bl31.mk | 1 |
4 files changed, 15 insertions, 51 deletions
diff --git a/bl31/aarch64/bl31_entrypoint.S b/bl31/aarch64/bl31_entrypoint.S index 6e48e313..10239837 100644 --- a/bl31/aarch64/bl31_entrypoint.S +++ b/bl31/aarch64/bl31_entrypoint.S @@ -152,12 +152,15 @@ func bl31_entrypoint msr spsel, #0 /* -------------------------------------------- - * Give ourselves a small coherent stack to - * ease the pain of initializing the MMU + * Allocate a stack whose memory will be marked + * as Normal-IS-WBWA when the MMU is enabled. + * There is no risk of reading stale stack + * memory after enabling the MMU as only the + * primary cpu is running at the moment. * -------------------------------------------- */ mrs x0, mpidr_el1 - bl platform_set_coherent_stack + bl platform_set_stack /* --------------------------------------------- * Perform platform specific early arch. setup @@ -175,14 +178,6 @@ func bl31_entrypoint bl bl31_plat_arch_setup /* --------------------------------------------- - * Give ourselves a stack allocated in Normal - * -IS-WBWA memory - * --------------------------------------------- - */ - mrs x0, mpidr_el1 - bl platform_set_stack - - /* --------------------------------------------- * Jump to main function. * --------------------------------------------- */ diff --git a/bl31/aarch64/context.S b/bl31/aarch64/context.S index 26982157..79b5d19c 100644 --- a/bl31/aarch64/context.S +++ b/bl31/aarch64/context.S @@ -43,23 +43,9 @@ .global el3_sysregs_context_save func el3_sysregs_context_save - mrs x10, sctlr_el3 - str x10, [x0, #CTX_SCTLR_EL3] - - mrs x11, cptr_el3 - stp x11, xzr, [x0, #CTX_CPTR_EL3] - - mrs x13, cntfrq_el0 - mrs x14, mair_el3 - stp x13, x14, [x0, #CTX_CNTFRQ_EL0] - - mrs x15, tcr_el3 - mrs x16, ttbr0_el3 - stp x15, x16, [x0, #CTX_TCR_EL3] - - mrs x17, daif - and x17, x17, #(DAIF_ABT_BIT | DAIF_DBG_BIT) - stp x17, xzr, [x0, #CTX_DAIF_EL3] + mrs x10, cptr_el3 + mrs x11, cntfrq_el0 + stp x10, x11, [x0, #CTX_CPTR_EL3] ret @@ -78,27 +64,9 @@ func el3_sysregs_context_save .global el3_sysregs_context_restore func el3_sysregs_context_restore - ldp x11, xzr, [x0, #CTX_CPTR_EL3] - msr cptr_el3, x11 - - ldp x13, x14, [x0, #CTX_CNTFRQ_EL0] - msr cntfrq_el0, x13 - msr mair_el3, x14 - - ldp x15, x16, [x0, #CTX_TCR_EL3] - msr tcr_el3, x15 - msr ttbr0_el3, x16 - - ldp x17, xzr, [x0, #CTX_DAIF_EL3] - mrs x11, daif - orr x17, x17, x11 - msr daif, x17 - - /* Make sure all the above changes are observed */ - isb - - ldr x10, [x0, #CTX_SCTLR_EL3] - msr sctlr_el3, x10 + ldp x13, x14, [x0, #CTX_CPTR_EL3] + msr cptr_el3, x13 + msr cntfrq_el0, x14 isb ret diff --git a/bl31/aarch64/runtime_exceptions.S b/bl31/aarch64/runtime_exceptions.S index a11cd71f..0ab86ab6 100644 --- a/bl31/aarch64/runtime_exceptions.S +++ b/bl31/aarch64/runtime_exceptions.S @@ -403,7 +403,7 @@ smc_handler64: mrs x17, elr_el3 mrs x18, scr_el3 stp x16, x17, [x6, #CTX_EL3STATE_OFFSET + CTX_SPSR_EL3] - stp x18, xzr, [x6, #CTX_EL3STATE_OFFSET + CTX_SCR_EL3] + str x18, [x6, #CTX_EL3STATE_OFFSET + CTX_SCR_EL3] /* Copy SCR_EL3.NS bit to the flag to indicate caller's security */ bfi x7, x18, #0, #1 @@ -446,7 +446,7 @@ el3_exit: ; .type el3_exit, %function * Restore SPSR_EL3, ELR_EL3 and SCR_EL3 prior to ERET * ----------------------------------------------------- */ - ldp x18, xzr, [sp, #CTX_EL3STATE_OFFSET + CTX_SCR_EL3] + ldr x18, [sp, #CTX_EL3STATE_OFFSET + CTX_SCR_EL3] ldp x16, x17, [sp, #CTX_EL3STATE_OFFSET + CTX_SPSR_EL3] msr scr_el3, x18 msr spsr_el3, x16 diff --git a/bl31/bl31.mk b/bl31/bl31.mk index 5555c319..fb17a2e6 100644 --- a/bl31/bl31.mk +++ b/bl31/bl31.mk @@ -48,6 +48,7 @@ BL31_SOURCES += bl31/bl31_main.c \ services/std_svc/psci/psci_afflvl_suspend.c \ services/std_svc/psci/psci_common.c \ services/std_svc/psci/psci_entry.S \ + services/std_svc/psci/psci_helpers.S \ services/std_svc/psci/psci_main.c \ services/std_svc/psci/psci_setup.c |