Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: riscv: Improve the trap handler #6819

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gagachang
Copy link
Contributor

In current RISC-V trap handler, we always save the context into struct thread_trap_regs first, and copy the saved context into another specific structure to handle that trap. For example, thread_user_ecall_handler() copies the struct thread_trap_regs to be struct thread_scall_regs before handling this system call.
In fact, such copies may drop the performance and they should be eliminated.

In this commit, the specific data structure used to save the context is determined early in the trap handler by checking the type of the trap from CSR XCAUSE. Thus, the copies between context structures are eliminated.

In current RISC-V trap handler, we always save the context into struct
thread_trap_regs first, and copy the saved context into another specific
structure to handle that trap. For example, thread_user_ecall_handler()
copies the struct thread_trap_regs to be struct thread_scall_regs before
handling this system call. In fact, such copies may drop the performance
and they should be eliminated.

In this commit, the specific data structure used to save the context is
determined early in the trap handler by checking the type of the trap
from CSR XCAUSE. Thus, the copies between context structures are
eliminated.

Signed-off-by: Alvin Chang <alvinga@andestech.com>
Tested-by: Yu Chien Peter Lin <peterlin@andestech.com>
@gagachang
Copy link
Contributor Author

Hi @maroueneboubakri , Would you like to review this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant