Lines Matching refs:regs
155 thread->regs.pc = (uint32_t)pc; in init_regs()
161 thread->regs.cpsr = read_cpsr() & ARM32_CPSR_E; in init_regs()
162 thread->regs.cpsr |= CPSR_MODE_SVC | CPSR_A | in init_regs()
165 if (thread->regs.pc & 1) in init_regs()
166 thread->regs.cpsr |= CPSR_T; in init_regs()
168 thread->regs.svc_sp = thread->stack_va_end; in init_regs()
174 thread->regs.r0 = a0; in init_regs()
175 thread->regs.r1 = a1; in init_regs()
176 thread->regs.r2 = a2; in init_regs()
177 thread->regs.r3 = a3; in init_regs()
178 thread->regs.r4 = a4; in init_regs()
179 thread->regs.r5 = a5; in init_regs()
180 thread->regs.r6 = a6; in init_regs()
181 thread->regs.r7 = a7; in init_regs()
190 thread->regs.pc = (uint64_t)pc; in init_regs()
196 thread->regs.cpsr = SPSR_64(SPSR_64_MODE_EL1, SPSR_64_MODE_SP_EL0, in init_regs()
199 thread->regs.sp = thread->stack_va_end; in init_regs()
205 thread->regs.x[0] = a0; in init_regs()
206 thread->regs.x[1] = a1; in init_regs()
207 thread->regs.x[2] = a2; in init_regs()
208 thread->regs.x[3] = a3; in init_regs()
209 thread->regs.x[4] = a4; in init_regs()
210 thread->regs.x[5] = a5; in init_regs()
211 thread->regs.x[6] = a6; in init_regs()
212 thread->regs.x[7] = a7; in init_regs()
215 thread->regs.x[29] = 0; in init_regs()
254 threads[n].regs.apiakey_hi = threads[n].keys.apia_hi; in __thread_alloc_and_run()
255 threads[n].regs.apiakey_lo = threads[n].keys.apia_lo; in __thread_alloc_and_run()
261 thread_resume(&threads[n].regs); in __thread_alloc_and_run()
283 static void copy_a0_to_a3(struct thread_ctx_regs *regs, uint32_t a0, in copy_a0_to_a3() argument
290 regs->r0 = a0; in copy_a0_to_a3()
291 regs->r1 = a1; in copy_a0_to_a3()
292 regs->r2 = a2; in copy_a0_to_a3()
293 regs->r3 = a3; in copy_a0_to_a3()
298 static void copy_a0_to_a3(struct thread_ctx_regs *regs, uint32_t a0, in copy_a0_to_a3() argument
305 regs->x[0] = a0; in copy_a0_to_a3()
306 regs->x[1] = a1; in copy_a0_to_a3()
307 regs->x[2] = a2; in copy_a0_to_a3()
308 regs->x[3] = a3; in copy_a0_to_a3()
357 static bool is_user_mode(struct thread_ctx_regs *regs) in is_user_mode() argument
359 return is_from_user((uint32_t)regs->cpsr); in is_user_mode()
391 if (is_user_mode(&threads[n].regs)) in thread_resume_from_rpc()
399 copy_a0_to_a3(&threads[n].regs, a0, a1, a2, a3); in thread_resume_from_rpc()
409 thread_resume(&threads[n].regs); in thread_resume_from_rpc()
483 vaddr_t sp = is_from_user(cpsr) ? thr->kern_sp : thr->regs.sp; in release_unused_kernel_stack()
485 vaddr_t sp = thr->regs.svc_sp; in release_unused_kernel_stack()
524 threads[ct].regs.cpsr = cpsr; in thread_state_suspend()
525 threads[ct].regs.pc = pc; in thread_state_suspend()
943 static void set_ctx_regs(struct thread_ctx_regs *regs, unsigned long a0, in set_ctx_regs() argument
953 *regs = (struct thread_ctx_regs){ }; in set_ctx_regs()
955 regs->r0 = a0; in set_ctx_regs()
956 regs->r1 = a1; in set_ctx_regs()
957 regs->r2 = a2; in set_ctx_regs()
958 regs->r3 = a3; in set_ctx_regs()
959 regs->usr_sp = user_sp; in set_ctx_regs()
960 regs->pc = entry_func; in set_ctx_regs()
961 regs->cpsr = spsr; in set_ctx_regs()
964 regs->x[0] = a0; in set_ctx_regs()
965 regs->x[1] = a1; in set_ctx_regs()
966 regs->x[2] = a2; in set_ctx_regs()
967 regs->x[3] = a3; in set_ctx_regs()
968 regs->pc = entry_func; in set_ctx_regs()
969 regs->cpsr = spsr; in set_ctx_regs()
970 regs->x[13] = user_sp; /* Used when running TA in Aarch32 */ in set_ctx_regs()
971 regs->sp = user_sp; /* Used when running TA in Aarch64 */ in set_ctx_regs()
974 regs->apiakey_hi = keys->apia_hi; in set_ctx_regs()
975 regs->apiakey_lo = keys->apia_lo; in set_ctx_regs()
978 regs->x[29] = 0; in set_ctx_regs()
1011 struct thread_ctx_regs *regs = NULL; in thread_enter_user_mode() local
1032 regs = thread_get_ctx_regs(); in thread_enter_user_mode()
1033 set_ctx_regs(regs, a0, a1, a2, a3, user_sp, entry_func, spsr, keys); in thread_enter_user_mode()
1034 rc = __thread_enter_user_mode(regs, exit_status0, exit_status1); in thread_enter_user_mode()
1066 static void setup_unwind_user_mode(struct thread_scall_regs *regs) in setup_unwind_user_mode() argument
1069 regs->lr = (uintptr_t)thread_unwind_user_mode; in setup_unwind_user_mode()
1070 regs->spsr = read_cpsr(); in setup_unwind_user_mode()
1073 regs->elr = (uintptr_t)thread_unwind_user_mode; in setup_unwind_user_mode()
1074 regs->spsr = spsr_from_pstate(); in setup_unwind_user_mode()
1082 regs->sp_el0 = (uint64_t)(regs + 1); in setup_unwind_user_mode()
1099 void __weak thread_scall_handler(struct thread_scall_regs *regs) in thread_scall_handler() argument
1121 if (sess->handle_scall(regs)) { in thread_scall_handler()
1126 setup_unwind_user_mode(regs); in thread_scall_handler()