boot_init_primary_early()init_primary()thread_init_core_local_stacks()- Set
thread_core_local.tmp_stack_va_endto the per-corestack_tmpfor all cores (CFG_TEE_CORE_NB_CORE). - Temporary stack (
stack_tmp) is used in the non-thread context, e.g. interrupt_from_kernel()interrupt_from_user()thread_std_abi_entry()thread_rpc_xstatus()- Set
thread_core_local.abt_stack_va_endto the per-corestack_abtfor all cores (CFG_TEE_CORE_NB_CORE). - Abort stack (
stack_abt) is used in the non-thread context for exception (except for ecall), e.g. exception_from_kernel()exception_from_user()- Call
thread_set_exceptions()withTHREAD_EXCP_ALLto mask both native and foreign interrupts. init_runtime()- Add heap section to the malloc pool.
thread_init_boot_thread()thread_init_threads()init_thread_stacks()- Call
thread_init_stack()to setthread_ctx.stack_va_endto the per-thread stack (#ifndef CFG_WITH_PAGER:stack_thread;#else: dynamically allocated stack) for all threads (CFG_NUM_THREADS). - P.S.
$spwill be set tothreads[0].stack_va_endafterboot_init_primary_early()is returned, before jumping toboot_init_primary_late(). pgt_init()- Set
l->curr_threadto Thread 0. - Set Thread 0’s state to
Active. thread_init_primary()thread_init_canaries()init_user_kcode()- Do nothing in RISC-V.
thread_init_per_cpu()- Set
mtvec/stvectothread_trap_vect(). - Set
mscratch/sscratchto0to indicate that the following traps are from kernel. init_sec_mon()- Do nothing as RISC-V doesn't have a secure monitor.
- Secure monitor is OpenSBI.
boot_init_primary_early()c
Loading...