mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 15:08:21 +00:00
kernel: add yield syscall
This commit is contained in:
@@ -98,6 +98,7 @@ extern syscall_getcpu
|
|||||||
extern syscall_sysinfo
|
extern syscall_sysinfo
|
||||||
extern syscall_writev
|
extern syscall_writev
|
||||||
extern syscall_readv
|
extern syscall_readv
|
||||||
|
extern syscall_yield
|
||||||
syscalltab:
|
syscalltab:
|
||||||
dq syscall_print
|
dq syscall_print
|
||||||
dq syscall_mmap
|
dq syscall_mmap
|
||||||
@@ -198,7 +199,8 @@ dq syscall_getcpu
|
|||||||
dq syscall_sysinfo
|
dq syscall_sysinfo
|
||||||
dq syscall_writev
|
dq syscall_writev
|
||||||
dq syscall_readv
|
dq syscall_readv
|
||||||
syscallcount equ 99
|
dq syscall_yield
|
||||||
|
syscallcount equ 100
|
||||||
section .text
|
section .text
|
||||||
global arch_syscall_entry
|
global arch_syscall_entry
|
||||||
; on entry:
|
; on entry:
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
#include <kernel/syscalls.h>
|
||||||
|
#include <kernel/scheduler.h>
|
||||||
|
|
||||||
|
syscallret_t syscall_yield(context_t *) {
|
||||||
|
syscallret_t ret = {0};
|
||||||
|
|
||||||
|
sched_yield();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
@@ -89,10 +89,10 @@ index 1ed110d..ded9114 100644
|
|||||||
+void backtrace_symbols_fd(void *const *, int, int) {
|
+void backtrace_symbols_fd(void *const *, int, int) {
|
||||||
}
|
}
|
||||||
diff --git mlibc-clean/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp
|
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-clean/sysdeps/astral/generic/generic.cpp
|
||||||
+++ mlibc-workdir/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;
|
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
|
+ // unlockpt is a no-op kernel side, so use this to check for an invalid pty
|
||||||
+ return sys_ioctl(fd, 0x13376167, NULL, &r);
|
+ 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) {
|
int sys_readv(int fd, const struct iovec *iovs, int iovc, ssize_t *bytes_read) {
|
||||||
long r;
|
long r;
|
||||||
@@ -121,3 +126,15 @@ index 7e4f2a1..a5f382d 100644
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user