Lines Matching refs:ctx
32 static void manage_extensions_secure(cpu_context_t *ctx);
70 void cm_setup_context(cpu_context_t *ctx, const entry_point_info_t *ep) in cm_setup_context() argument
78 assert(ctx != NULL); in cm_setup_context()
83 zeromem(ctx, sizeof(*ctx)); in cm_setup_context()
221 write_ctx_reg(get_el3state_ctx(ctx), CTX_CPTR_EL3, read_cptr_el3()); in cm_setup_context()
223 manage_extensions_secure(ctx); in cm_setup_context()
335 write_ctx_reg(get_el1_sysregs_ctx(ctx), CTX_SCTLR_EL1, sctlr_elx); in cm_setup_context()
345 write_ctx_reg((get_el1_sysregs_ctx(ctx)), (CTX_ACTLR_EL1), (actlr_elx)); in cm_setup_context()
351 state = get_el3state_ctx(ctx); in cm_setup_context()
360 gp_regs = get_gpregs_ctx(ctx); in cm_setup_context()
369 static void manage_extensions_nonsecure(bool el2_unused, cpu_context_t *ctx) in manage_extensions_nonsecure() argument
377 amu_enable(el2_unused, ctx); in manage_extensions_nonsecure()
382 sme_enable(ctx); in manage_extensions_nonsecure()
385 sve_enable(ctx); in manage_extensions_nonsecure()
397 sys_reg_trace_enable(ctx); in manage_extensions_nonsecure()
409 static void manage_extensions_secure(cpu_context_t *ctx) in manage_extensions_secure() argument
418 sme_enable(ctx); in manage_extensions_secure()
424 sme_disable(ctx); in manage_extensions_secure()
432 sve_enable(ctx); in manage_extensions_secure()
438 sve_disable(ctx); in manage_extensions_secure()
452 cpu_context_t *ctx; in cm_init_context_by_index() local
453 ctx = cm_get_context_by_index(cpu_idx, GET_SECURITY_STATE(ep->h.attr)); in cm_init_context_by_index()
454 cm_setup_context(ctx, ep); in cm_init_context_by_index()
464 cpu_context_t *ctx; in cm_init_my_context() local
465 ctx = cm_get_context(GET_SECURITY_STATE(ep->h.attr)); in cm_init_my_context()
466 cm_setup_context(ctx, ep); in cm_init_my_context()
481 cpu_context_t *ctx = cm_get_context(security_state); in cm_prepare_el3_exit() local
485 assert(ctx != NULL); in cm_prepare_el3_exit()
488 scr_el3 = read_ctx_reg(get_el3state_ctx(ctx), in cm_prepare_el3_exit()
492 sctlr_elx = read_ctx_reg(get_el1_sysregs_ctx(ctx), in cm_prepare_el3_exit()
687 manage_extensions_nonsecure(el2_unused, ctx); in cm_prepare_el3_exit()
708 cpu_context_t *ctx; in cm_el2_sysregs_context_save() local
710 ctx = cm_get_context(security_state); in cm_el2_sysregs_context_save()
711 assert(ctx != NULL); in cm_el2_sysregs_context_save()
713 el2_sysregs_context_save(get_el2_sysregs_ctx(ctx)); in cm_el2_sysregs_context_save()
730 cpu_context_t *ctx; in cm_el2_sysregs_context_restore() local
732 ctx = cm_get_context(security_state); in cm_el2_sysregs_context_restore()
733 assert(ctx != NULL); in cm_el2_sysregs_context_restore()
735 el2_sysregs_context_restore(get_el2_sysregs_ctx(ctx)); in cm_el2_sysregs_context_restore()
747 cpu_context_t *ctx; in cm_el1_sysregs_context_save() local
749 ctx = cm_get_context(security_state); in cm_el1_sysregs_context_save()
750 assert(ctx != NULL); in cm_el1_sysregs_context_save()
752 el1_sysregs_context_save(get_el1_sysregs_ctx(ctx)); in cm_el1_sysregs_context_save()
764 cpu_context_t *ctx; in cm_el1_sysregs_context_restore() local
766 ctx = cm_get_context(security_state); in cm_el1_sysregs_context_restore()
767 assert(ctx != NULL); in cm_el1_sysregs_context_restore()
769 el1_sysregs_context_restore(get_el1_sysregs_ctx(ctx)); in cm_el1_sysregs_context_restore()
785 cpu_context_t *ctx; in cm_set_elr_el3() local
788 ctx = cm_get_context(security_state); in cm_set_elr_el3()
789 assert(ctx != NULL); in cm_set_elr_el3()
792 state = get_el3state_ctx(ctx); in cm_set_elr_el3()
803 cpu_context_t *ctx; in cm_set_elr_spsr_el3() local
806 ctx = cm_get_context(security_state); in cm_set_elr_spsr_el3()
807 assert(ctx != NULL); in cm_set_elr_spsr_el3()
810 state = get_el3state_ctx(ctx); in cm_set_elr_spsr_el3()
824 cpu_context_t *ctx; in cm_write_scr_el3_bit() local
828 ctx = cm_get_context(security_state); in cm_write_scr_el3_bit()
829 assert(ctx != NULL); in cm_write_scr_el3_bit()
841 state = get_el3state_ctx(ctx); in cm_write_scr_el3_bit()
854 cpu_context_t *ctx; in cm_get_scr_el3() local
857 ctx = cm_get_context(security_state); in cm_get_scr_el3()
858 assert(ctx != NULL); in cm_get_scr_el3()
861 state = get_el3state_ctx(ctx); in cm_get_scr_el3()
872 cpu_context_t *ctx; in cm_set_next_eret_context() local
874 ctx = cm_get_context(security_state); in cm_set_next_eret_context()
875 assert(ctx != NULL); in cm_set_next_eret_context()
877 cm_set_next_context(ctx); in cm_set_next_eret_context()