[kernel] Add userspace threading
Implement the syscalls necessary for threads to create other threads in their same process. This involved rearranging a number of syscalls, as well as implementing object_wait and a basic implementation of a process' list of handles.
This commit is contained in:
33
src/kernel/syscalls/system.cpp
Normal file
33
src/kernel/syscalls/system.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "j6/errors.h"
|
||||
#include "j6/types.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "scheduler.h"
|
||||
|
||||
namespace syscalls {
|
||||
|
||||
j6_status_t
|
||||
system_log(const char *message)
|
||||
{
|
||||
if (message == nullptr) {
|
||||
return j6_err_invalid_arg;
|
||||
}
|
||||
|
||||
auto &s = scheduler::get();
|
||||
TCB *tcb = s.current();
|
||||
thread *th = thread::from_tcb(tcb);
|
||||
log::info(logs::syscall, "Message[%llx]: %s", th->koid(), message);
|
||||
return j6_status_ok;
|
||||
}
|
||||
|
||||
j6_status_t
|
||||
system_noop()
|
||||
{
|
||||
auto &s = scheduler::get();
|
||||
TCB *tcb = s.current();
|
||||
thread *th = thread::from_tcb(tcb);
|
||||
log::debug(logs::syscall, "Thread %llx called noop syscall.", th->koid());
|
||||
return j6_status_ok;
|
||||
}
|
||||
|
||||
} // namespace syscalls
|
||||
Reference in New Issue
Block a user