Lines Matching refs:ctx
94 struct trusty_cpu_ctx *ctx = get_trusty_ctx(); in trusty_context_switch() local
97 assert(ctx->saved_security_state != security_state); in trusty_context_switch()
127 ctx->saved_security_state = security_state; in trusty_context_switch()
128 ret_args = trusty_context_switch_helper(&ctx->saved_sp, &args); in trusty_context_switch()
130 assert(ctx->saved_security_state == ((security_state == 0U) ? 1U : 0U)); in trusty_context_switch()
148 struct trusty_cpu_ctx *ctx = get_trusty_ctx(); in trusty_fiq_handler() local
157 if (ctx->fiq_handler_active != 0) { in trusty_fiq_handler()
162 ctx->fiq_handler_active = 1; in trusty_fiq_handler()
163 (void)memcpy(&ctx->fiq_gpregs, get_gpregs_ctx(handle), sizeof(ctx->fiq_gpregs)); in trusty_fiq_handler()
164 ctx->fiq_pc = SMC_GET_EL3(handle, CTX_ELR_EL3); in trusty_fiq_handler()
165 ctx->fiq_cpsr = SMC_GET_EL3(handle, CTX_SPSR_EL3); in trusty_fiq_handler()
166 ctx->fiq_sp_el1 = read_el1_ctx_common(get_el1_sysregs_ctx(handle), sp_el1); in trusty_fiq_handler()
168 write_el1_ctx_common(get_el1_sysregs_ctx(handle), sp_el1, ctx->fiq_handler_sp); in trusty_fiq_handler()
169 cm_set_elr_spsr_el3(NON_SECURE, ctx->fiq_handler_pc, (uint32_t)ctx->fiq_handler_cpsr); in trusty_fiq_handler()
177 struct trusty_cpu_ctx *ctx; in trusty_set_fiq_handler() local
184 ctx = &trusty_cpu_ctx[cpu]; in trusty_set_fiq_handler()
185 ctx->fiq_handler_pc = handler; in trusty_set_fiq_handler()
186 ctx->fiq_handler_cpsr = SMC_GET_EL3(handle, CTX_SPSR_EL3); in trusty_set_fiq_handler()
187 ctx->fiq_handler_sp = stack; in trusty_set_fiq_handler()
194 struct trusty_cpu_ctx *ctx = get_trusty_ctx(); in trusty_get_fiq_regs() local
195 uint64_t sp_el0 = read_ctx_reg(&ctx->fiq_gpregs, CTX_GPREG_SP_EL0); in trusty_get_fiq_regs()
197 SMC_RET4(handle, ctx->fiq_pc, ctx->fiq_cpsr, sp_el0, ctx->fiq_sp_el1); in trusty_get_fiq_regs()
203 struct trusty_cpu_ctx *ctx = get_trusty_ctx(); in trusty_fiq_exit() local
205 if (ctx->fiq_handler_active == 0) { in trusty_fiq_exit()
225 (void)memcpy(get_gpregs_ctx(handle), &ctx->fiq_gpregs, sizeof(ctx->fiq_gpregs)); in trusty_fiq_exit()
226 ctx->fiq_handler_active = 0; in trusty_fiq_exit()
227 write_el1_ctx_common(get_el1_sysregs_ctx(handle), sp_el1, ctx->fiq_sp_el1); in trusty_fiq_exit()
228 cm_set_elr_spsr_el3(NON_SECURE, ctx->fiq_pc, (uint32_t)ctx->fiq_cpsr); in trusty_fiq_exit()
314 struct trusty_cpu_ctx *ctx = get_trusty_ctx(); in trusty_init() local
316 uint64_t reg_width = GET_RW(read_ctx_reg(get_el3state_ctx(&ctx->cpu_ctx), in trusty_init()
329 cm_set_context(&ctx->cpu_ctx, SECURE); in trusty_init()
346 ctx->saved_security_state = ~0U; /* initial saved state is invalid */ in trusty_init()
347 (void)trusty_init_context_stack(&ctx->saved_sp, &ctx->secure_stack.end); in trusty_init()
349 (void)trusty_context_switch_helper(&ctx->saved_sp, &zero_args); in trusty_init()
389 struct trusty_cpu_ctx *ctx = get_trusty_ctx(); in trusty_cpu_on_finish_handler() local
391 if (ctx->saved_sp == NULL) { in trusty_cpu_on_finish_handler()