Lines Matching refs:ctx

92 	struct trusty_cpu_ctx *ctx = get_trusty_ctx();  in trusty_context_switch()  local
95 assert(ctx->saved_security_state != security_state); in trusty_context_switch()
123 ctx->saved_security_state = security_state; in trusty_context_switch()
124 ret_args = trusty_context_switch_helper(&ctx->saved_sp, &args); in trusty_context_switch()
126 assert(ctx->saved_security_state == ((security_state == 0U) ? 1U : 0U)); in trusty_context_switch()
143 struct trusty_cpu_ctx *ctx = get_trusty_ctx(); in trusty_fiq_handler() local
152 if (ctx->fiq_handler_active != 0) { in trusty_fiq_handler()
157 ctx->fiq_handler_active = 1; in trusty_fiq_handler()
158 (void)memcpy(&ctx->fiq_gpregs, get_gpregs_ctx(handle), sizeof(ctx->fiq_gpregs)); in trusty_fiq_handler()
159 ctx->fiq_pc = SMC_GET_EL3(handle, CTX_ELR_EL3); in trusty_fiq_handler()
160 ctx->fiq_cpsr = SMC_GET_EL3(handle, CTX_SPSR_EL3); in trusty_fiq_handler()
161 ctx->fiq_sp_el1 = read_ctx_reg(get_el1_sysregs_ctx(handle), CTX_SP_EL1); in trusty_fiq_handler()
163 write_ctx_reg(get_el1_sysregs_ctx(handle), CTX_SP_EL1, ctx->fiq_handler_sp); in trusty_fiq_handler()
164 cm_set_elr_spsr_el3(NON_SECURE, ctx->fiq_handler_pc, (uint32_t)ctx->fiq_handler_cpsr); in trusty_fiq_handler()
172 struct trusty_cpu_ctx *ctx; in trusty_set_fiq_handler() local
179 ctx = &trusty_cpu_ctx[cpu]; in trusty_set_fiq_handler()
180 ctx->fiq_handler_pc = handler; in trusty_set_fiq_handler()
181 ctx->fiq_handler_cpsr = SMC_GET_EL3(handle, CTX_SPSR_EL3); in trusty_set_fiq_handler()
182 ctx->fiq_handler_sp = stack; in trusty_set_fiq_handler()
189 struct trusty_cpu_ctx *ctx = get_trusty_ctx(); in trusty_get_fiq_regs() local
190 uint64_t sp_el0 = read_ctx_reg(&ctx->fiq_gpregs, CTX_GPREG_SP_EL0); in trusty_get_fiq_regs()
192 SMC_RET4(handle, ctx->fiq_pc, ctx->fiq_cpsr, sp_el0, ctx->fiq_sp_el1); in trusty_get_fiq_regs()
198 struct trusty_cpu_ctx *ctx = get_trusty_ctx(); in trusty_fiq_exit() local
200 if (ctx->fiq_handler_active == 0) { in trusty_fiq_exit()
220 (void)memcpy(get_gpregs_ctx(handle), &ctx->fiq_gpregs, sizeof(ctx->fiq_gpregs)); in trusty_fiq_exit()
221 ctx->fiq_handler_active = 0; in trusty_fiq_exit()
222 write_ctx_reg(get_el1_sysregs_ctx(handle), CTX_SP_EL1, ctx->fiq_sp_el1); in trusty_fiq_exit()
223 cm_set_elr_spsr_el3(NON_SECURE, ctx->fiq_pc, (uint32_t)ctx->fiq_cpsr); in trusty_fiq_exit()
309 struct trusty_cpu_ctx *ctx = get_trusty_ctx(); in trusty_init() local
311 uint64_t reg_width = GET_RW(read_ctx_reg(get_el3state_ctx(&ctx->cpu_ctx), in trusty_init()
324 cm_set_context(&ctx->cpu_ctx, SECURE); in trusty_init()
341 ctx->saved_security_state = ~0U; /* initial saved state is invalid */ in trusty_init()
342 (void)trusty_init_context_stack(&ctx->saved_sp, &ctx->secure_stack.end); in trusty_init()
344 (void)trusty_context_switch_helper(&ctx->saved_sp, &zero_args); in trusty_init()
384 struct trusty_cpu_ctx *ctx = get_trusty_ctx(); in trusty_cpu_on_finish_handler() local
386 if (ctx->saved_sp == NULL) { in trusty_cpu_on_finish_handler()