123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- #include <assert.h>
- #include <string.h>
- #include <arch_helpers.h>
- #include <common/bl_common.h>
- #include <common/debug.h>
- #include <lib/el3_runtime/context_mgmt.h>
- #include <lib/utils.h>
- #include <plat/common/platform.h>
- #include "pncd_private.h"
- void pncd_init_pnc_ep_state(struct entry_point_info *pnc_entry_point,
- uint64_t pc,
- pnc_context_t *pnc_ctx)
- {
- uint32_t ep_attr;
-
- assert(pnc_ctx);
- assert(pnc_entry_point);
- assert(pc);
-
- pnc_ctx->mpidr = read_mpidr();
- cm_set_context(&pnc_ctx->cpu_ctx, SECURE);
-
- ep_attr = SECURE | EP_ST_ENABLE;
- if (read_sctlr_el3() & SCTLR_EE_BIT) {
- ep_attr |= EP_EE_BIG;
- }
- SET_PARAM_HEAD(pnc_entry_point, PARAM_EP, VERSION_1, ep_attr);
- pnc_entry_point->pc = pc;
- pnc_entry_point->spsr = SPSR_64(MODE_EL1,
- MODE_SP_ELX,
- DISABLE_ALL_EXCEPTIONS);
- memset(&pnc_entry_point->args, 0, sizeof(pnc_entry_point->args));
- }
- uint64_t pncd_synchronous_sp_entry(pnc_context_t *pnc_ctx)
- {
- assert(pnc_ctx != NULL);
- assert(pnc_ctx->c_rt_ctx == 0U);
-
- assert(cm_get_context(SECURE) == &pnc_ctx->cpu_ctx);
- cm_el1_sysregs_context_restore(SECURE);
- #if CTX_INCLUDE_FPREGS
- simd_ctx_restore(SECURE);
- #endif
- cm_set_next_eret_context(SECURE);
- return pncd_enter_sp(&pnc_ctx->c_rt_ctx);
- }
- void pncd_synchronous_sp_exit(pnc_context_t *pnc_ctx, uint64_t ret)
- {
- assert(pnc_ctx != NULL);
-
- assert(cm_get_context(SECURE) == &pnc_ctx->cpu_ctx);
- cm_el1_sysregs_context_save(SECURE);
- #if CTX_INCLUDE_FPREGS
- simd_ctx_save(SECURE, false);
- #endif
- assert(pnc_ctx->c_rt_ctx != 0);
- pncd_exit_sp(pnc_ctx->c_rt_ctx, ret);
-
- panic();
- }
|