Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Kernel/libc: sched_yield implementation and syscall
Browse files Browse the repository at this point in the history
  • Loading branch information
byteduck committed Apr 20, 2024
1 parent f1e77ee commit 3635f35
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kernel/syscall/syscall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ int handle_syscall(ThreadRegisters& regs, uint32_t call, uint32_t arg1, uint32_t
return cur_proc->sys_accept(arg1, (struct sockaddr*) arg2, (uint32_t*) arg3);
case SYS_FUTEX:
return cur_proc->sys_futex((int*) arg1, arg2);
case SYS_YIELD:
TaskManager::yield();
return 0;

//TODO: Implement these syscalls
case SYS_TIMES:
Expand Down
1 change: 1 addition & 0 deletions kernel/syscall/syscall_numbers.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
#define SYS_SHUTDOWN 88
#define SYS_ACCEPT 89
#define SYS_FUTEX 90
#define SYS_YIELD 91

#ifndef DUCKOS_KERNEL
#include <sys/types.h>
Expand Down
2 changes: 2 additions & 0 deletions libraries/libc/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
/* Copyright © 2016-2024 Byteduck */

#include "sched.h"
#include "sys/syscall.h"

// TODO

int sched_yield() {
syscall(SYS_YIELD);
return 0;
}

Expand Down

0 comments on commit 3635f35

Please sign in to comment.