diff --git a/kernel-src/arch/x86-64/syscall.asm b/kernel-src/arch/x86-64/syscall.asm index d72c4875..b756aea3 100644 --- a/kernel-src/arch/x86-64/syscall.asm +++ b/kernel-src/arch/x86-64/syscall.asm @@ -98,6 +98,7 @@ extern syscall_getcpu extern syscall_sysinfo extern syscall_writev extern syscall_readv +extern syscall_yield syscalltab: dq syscall_print dq syscall_mmap @@ -198,7 +199,8 @@ dq syscall_getcpu dq syscall_sysinfo dq syscall_writev dq syscall_readv -syscallcount equ 99 +dq syscall_yield +syscallcount equ 100 section .text global arch_syscall_entry ; on entry: diff --git a/kernel-src/sys/syscalls/yield.c b/kernel-src/sys/syscalls/yield.c new file mode 100644 index 00000000..a4925542 --- /dev/null +++ b/kernel-src/sys/syscalls/yield.c @@ -0,0 +1,10 @@ +#include +#include + +syscallret_t syscall_yield(context_t *) { + syscallret_t ret = {0}; + + sched_yield(); + + return ret; +} diff --git a/patches/mlibc/jinx-working-patch.patch b/patches/mlibc/jinx-working-patch.patch index 4b6dae28..2ef8cb3f 100644 --- a/patches/mlibc/jinx-working-patch.patch +++ b/patches/mlibc/jinx-working-patch.patch @@ -89,10 +89,10 @@ index 1ed110d..ded9114 100644 +void backtrace_symbols_fd(void *const *, int, int) { } diff --git mlibc-clean/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp -index 939925e..5ee7fad 100644 +index 939925e..eb6a6aa 100644 --- mlibc-clean/sysdeps/astral/generic/generic.cpp +++ mlibc-workdir/sysdeps/astral/generic/generic.cpp -@@ -47,6 +47,12 @@ namespace mlibc { +@@ -47,6 +47,17 @@ namespace mlibc { return 0; } @@ -101,6 +101,11 @@ index 939925e..5ee7fad 100644 + // unlockpt is a no-op kernel side, so use this to check for an invalid pty + return sys_ioctl(fd, 0x13376167, NULL, &r); + } ++ ++ void sys_yield() { ++ long r; ++ syscall(SYSCALL_YIELD, &r); ++ } + int sys_readv(int fd, const struct iovec *iovs, int iovc, ssize_t *bytes_read) { long r; @@ -121,3 +126,15 @@ index 7e4f2a1..a5f382d 100644 #ifdef __cplusplus extern "C" { +diff --git mlibc-clean/sysdeps/astral/include/astral/syscall.h mlibc-workdir/sysdeps/astral/include/astral/syscall.h +index a6c4067..d1656ca 100644 +--- mlibc-clean/sysdeps/astral/include/astral/syscall.h ++++ mlibc-workdir/sysdeps/astral/include/astral/syscall.h +@@ -103,6 +103,7 @@ + #define SYSCALL_SYSINFO 96 + #define SYSCALL_WRITEV 97 + #define SYSCALL_READV 98 ++#define SYSCALL_YIELD 99 + + #ifndef __MLIBC_ABI_ONLY +