thread_enter_user_mode()c
| 2025-1-4
本文字數 72閱讀時長 1 分鐘
  • thread_enter_user_mode()
    • Disable all interrupts.
    • Call xstatus_for_xret() to get xstatus with xstatus.PIE set to 1, xstatus.PP set to U-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 to thread_ctx_regs.ra and then set to $xepc so that when xret is called to return to U-mode, entry_func will be executed.
    • Re-enable original interrupts.
Loading...
目錄