-
Notifications
You must be signed in to change notification settings - Fork 5.3k
feat: add support for restartable system calls on RISC-V64 #10520
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -258,14 +258,48 @@ struct signal_ucontext | |||||
| struct rt_hw_stack_frame frame; | ||||||
| }; | ||||||
|
|
||||||
| void *arch_signal_ucontext_restore(rt_base_t user_sp) | ||||||
| void arch_syscall_restart(void *sp, void *ksp); | ||||||
|
|
||||||
| void arch_signal_check_erestart(void *eframe, void *ksp) | ||||||
| { | ||||||
| struct rt_hw_stack_frame *exp_frame = eframe; | ||||||
| long rc = exp_frame->a0; | ||||||
| long sys_id = exp_frame->a7; | ||||||
|
|
||||||
| (void)sys_id; | ||||||
|
|
||||||
| if (rc == -ERESTART) | ||||||
| { | ||||||
| LOG_D("%s(rc=%ld,sys_id=%ld,pid=%d)", __func__, rc, sys_id, lwp_self()->pid); | ||||||
| LOG_D("%s: restart rc = %ld", lwp_get_syscall_name(sys_id), rc); | ||||||
|
|
||||||
| /* t0 stores the copy of user's first syscall argument */ | ||||||
| exp_frame->a0 = exp_frame->t0; | ||||||
| /* adjust for epc auto-increment in syscall_handler */ | ||||||
| exp_frame->epc -= 4; | ||||||
| /* copy exception frame from user stack to kernel stack */ | ||||||
| lwp_memcpy(ksp - sizeof(*exp_frame), exp_frame, sizeof(*exp_frame)); | ||||||
|
||||||
| lwp_memcpy(ksp - sizeof(*exp_frame), exp_frame, sizeof(*exp_frame)); | |
| lwp_memcpy(ksp - sizeof(*exp_frame), exp_frame, sizeof(*exp_frame)); |
Copilot
AI
Aug 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant return statement at the end of a void function. This return statement can be removed for cleaner code.
在void函数末尾的冗余return语句。可以移除此return语句使代码更简洁。
| return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sys_id variable is assigned but only used to suppress unused variable warnings. Consider removing the variable assignment if it's truly unused, or use it in the LOG_D statements that follow.
sys_id变量被赋值但仅用于抑制未使用变量警告。如果确实未使用,考虑移除变量赋值,或在后续的LOG_D语句中使用它。