forked from OP-TEE/optee_os
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: riscv: Improve thread user mode record
The following steps descript the program flow of kernel context during entering and exiting user mode: 1. thread_enter_user_mode(): prepare user mode context 2. __thread_enter_user_mode(): allocate thread_user_mode_rec from kernel stack, and save kernel RA and callee-saved registers into thread_user_mode_rec. Save kernel SP into thread context. Enter user mode context. If there is a user ecall which wants to return to kernel mode: 3. ecall_from_user(): Already set kernel SP, GP, and TP. 4. setup_unwind_user_mode(): prepare to return to kernel mode. If there is a user abort which should return to kernel mode: 3. abort_from_user(): Already set kernel SP, GP, and TP. 4. handle_user_mode_panic(): prepare to return to kernel mode. 5. XRET to kernel mode with kernel SP, GP, and TP are already set. 6. thread_unwind_user_mode(): Restore kernel RA and callee-saved registers from thread_user_mode_rec. Thus, it's unnecessary to save kernel SP and GP into thread_user_mode_rec, since they have already set by trap handler and it's unnecessary to set them again in thread_unwind_user_mode(). Also, rename THREAD_USER_MODE_REC_XX to their register names. Signed-off-by: Alvin Chang <alvinga@andestech.com>
- Loading branch information
Showing
3 changed files
with
23 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters