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()
125 ctx->saved_security_state = security_state; in trusty_context_switch()
126 ret_args = trusty_context_switch_helper(&ctx->saved_sp, &args); in trusty_context_switch()
128 assert(ctx->saved_security_state == ((security_state == 0U) ? 1U : 0U)); in trusty_context_switch()
145 struct trusty_cpu_ctx *ctx = get_trusty_ctx(); in trusty_fiq_handler() local
154 if (ctx->fiq_handler_active != 0) { in trusty_fiq_handler()
159 ctx->fiq_handler_active = 1; in trusty_fiq_handler()
160 (void)memcpy(&ctx->fiq_gpregs, get_gpregs_ctx(handle), sizeof(ctx->fiq_gpregs)); in trusty_fiq_handler()
161 ctx->fiq_pc = SMC_GET_EL3(handle, CTX_ELR_EL3); in trusty_fiq_handler()
162 ctx->fiq_cpsr = SMC_GET_EL3(handle, CTX_SPSR_EL3); in trusty_fiq_handler()
163 ctx->fiq_sp_el1 = read_ctx_reg(get_el1_sysregs_ctx(handle), CTX_SP_EL1); in trusty_fiq_handler()
165 write_ctx_reg(get_el1_sysregs_ctx(handle), CTX_SP_EL1, ctx->fiq_handler_sp); in trusty_fiq_handler()
166 cm_set_elr_spsr_el3(NON_SECURE, ctx->fiq_handler_pc, (uint32_t)ctx->fiq_handler_cpsr); in trusty_fiq_handler()
174 struct trusty_cpu_ctx *ctx; in trusty_set_fiq_handler() local
181 ctx = &trusty_cpu_ctx[cpu]; in trusty_set_fiq_handler()
182 ctx->fiq_handler_pc = handler; in trusty_set_fiq_handler()
183 ctx->fiq_handler_cpsr = SMC_GET_EL3(handle, CTX_SPSR_EL3); in trusty_set_fiq_handler()
184 ctx->fiq_handler_sp = stack; in trusty_set_fiq_handler()
191 struct trusty_cpu_ctx *ctx = get_trusty_ctx(); in trusty_get_fiq_regs() local
192 uint64_t sp_el0 = read_ctx_reg(&ctx->fiq_gpregs, CTX_GPREG_SP_EL0); in trusty_get_fiq_regs()
194 SMC_RET4(handle, ctx->fiq_pc, ctx->fiq_cpsr, sp_el0, ctx->fiq_sp_el1); in trusty_get_fiq_regs()
200 struct trusty_cpu_ctx *ctx = get_trusty_ctx(); in trusty_fiq_exit() local
202 if (ctx->fiq_handler_active == 0) { in trusty_fiq_exit()
222 (void)memcpy(get_gpregs_ctx(handle), &ctx->fiq_gpregs, sizeof(ctx->fiq_gpregs)); in trusty_fiq_exit()
223 ctx->fiq_handler_active = 0; in trusty_fiq_exit()
224 write_ctx_reg(get_el1_sysregs_ctx(handle), CTX_SP_EL1, ctx->fiq_sp_el1); in trusty_fiq_exit()
225 cm_set_elr_spsr_el3(NON_SECURE, ctx->fiq_pc, (uint32_t)ctx->fiq_cpsr); in trusty_fiq_exit()
311 struct trusty_cpu_ctx *ctx = get_trusty_ctx(); in trusty_init() local
313 uint64_t reg_width = GET_RW(read_ctx_reg(get_el3state_ctx(&ctx->cpu_ctx), in trusty_init()
326 cm_set_context(&ctx->cpu_ctx, SECURE); in trusty_init()
343 ctx->saved_security_state = ~0U; /* initial saved state is invalid */ in trusty_init()
344 (void)trusty_init_context_stack(&ctx->saved_sp, &ctx->secure_stack.end); in trusty_init()
346 (void)trusty_context_switch_helper(&ctx->saved_sp, &zero_args); in trusty_init()
386 struct trusty_cpu_ctx *ctx = get_trusty_ctx(); in trusty_cpu_on_finish_handler() local
388 if (ctx->saved_sp == NULL) { in trusty_cpu_on_finish_handler()