thread_enter_user_mode()
- Disable all interrupts.
- Call
xstatus_for_xret()
to getxstatus
withxstatus.PIE
set to1
,xstatus.PP
set toU-mode
. - The returned
xstatus
will be saved along with$a0
,$a1
,$a2
,$a3
,user_sp
,entry_func
, and$xie
to current thread’s reg context (struct thread_ctx_regs
). - Call
__thread_enter_user_mode()
to switch to U-mode.entry_func
is set tothread_ctx_regs.ra
and then set to$xepc
so that whenxret
is called to return to U-mode,entry_func
will be executed. - Re-enable original interrupts.
thread_enter_user_mode()c
Loading...