[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:
2020-07-26 16:02:38 -07:00
parent 4cf222a5bb
commit ae3290c53d
22 changed files with 481 additions and 255 deletions

View 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