[kernel] Use map for process handles

Replace linearly-indexed vector of handles with new kutil::map. Also
provide thread::current() and process::current() accessors so that every
syscall doesn't need to include the scheduler to deduce the current
process.
This commit is contained in:
2020-09-13 15:54:47 -07:00
parent 245f260d67
commit 9dee5e4138
6 changed files with 43 additions and 43 deletions

View File

@@ -1,4 +1,5 @@
#include "j6/signals.h"
#include "cpu.h"
#include "log.h"
#include "objects/thread.h"
#include "objects/process.h"
@@ -40,6 +41,12 @@ thread::from_tcb(TCB *tcb)
return reinterpret_cast<thread*>(kutil::offset_pointer(tcb, offset));
}
thread &
thread::current()
{
return *bsp_cpu_data.t;
}
void
thread::wait_on_signals(kobject *obj, j6_signal_t signals)
{