implement sys_sched_yield

This commit is contained in:
Ashwin Naren
2025-12-23 11:45:55 -08:00
parent 88549fee5a
commit 888c099072
3 changed files with 9 additions and 3 deletions

View File

@@ -50,7 +50,7 @@
| 0x2f (47) | fallocate | (int fd, int mode, loff_t offset, loff_t len) | __arm64_sys_fallocate | false |
| 0x30 (48) | faccessat | (int dfd, const char *filename, int mode) | __arm64_sys_faccessat | true |
| 0x31 (49) | chdir | (const char *filename) | __arm64_sys_chdir | true |
| 0x32 (50) | fchdir | (unsigned int fd) | __arm64_sys_fchdir | true |
| 0x32 (50) | fchdir | (unsigned int fd) | __arm64_sys_fchdir | true |
| 0x33 (51) | chroot | (const char *filename) | __arm64_sys_chroot | true |
| 0x34 (52) | fchmod | (unsigned int fd, umode_t mode) | __arm64_sys_fchmod | false |
| 0x35 (53) | fchmodat | (int dfd, const char *filename, umode_t mode) | __arm64_sys_fchmodat | false |
@@ -124,7 +124,7 @@
| 0x79 (121) | sched_getparam | (pid_t pid, struct sched_param *param) | __arm64_sys_sched_getparam | false |
| 0x7a (122) | sched_setaffinity | (pid_t pid, unsigned int len, unsigned long *user_mask_ptr) | __arm64_sys_sched_setaffinity | false |
| 0x7b (123) | sched_getaffinity | (pid_t pid, unsigned int len, unsigned long *user_mask_ptr) | __arm64_sys_sched_getaffinity | false |
| 0x7c (124) | sched_yield | () | __arm64_sys_sched_yield | false |
| 0x7c (124) | sched_yield | () | __arm64_sys_sched_yield | true |
| 0x7d (125) | sched_get_priority_max | (int policy) | __arm64_sys_sched_get_priority_max | false |
| 0x7e (126) | sched_get_priority_min | (int policy) | __arm64_sys_sched_get_priority_min | false |
| 0x7f (127) | sched_rr_get_interval | (pid_t pid, struct __kernel_timespec *interval) | __arm64_sys_sched_rr_get_interval | false |

View File

@@ -59,7 +59,7 @@ use crate::{
},
threading::{futex::sys_futex, sys_set_robust_list, sys_set_tid_address},
},
sched::current_task,
sched::{current_task, sys_sched_yield},
};
use alloc::boxed::Box;
use libkernel::{
@@ -182,6 +182,7 @@ pub async fn handle_syscall() {
0x63 => sys_set_robust_list(TUA::from_value(arg1 as _), arg2 as _).await,
0x65 => sys_nanosleep(TUA::from_value(arg1 as _), TUA::from_value(arg2 as _)).await,
0x71 => sys_clock_gettime(arg1 as _, TUA::from_value(arg2 as _)).await,
0x7c => sys_sched_yield(),
0x81 => sys_kill(arg1 as _, arg2.into()),
0x82 => sys_tkill(arg1 as _, arg2.into()),
0x84 => sys_sigaltstack(TUA::from_value(arg1 as _), TUA::from_value(arg2 as _)).await,

View File

@@ -224,3 +224,8 @@ fn get_idle_task() -> Arc<Task> {
.get_or_init(|| Arc::new(ArchImpl::create_idle_task()))
.clone()
}
pub fn sys_sched_yield() -> Result<usize> {
schedule();
Ok(0)
}