[kernel] Make capabilities/handles global

Instead of handles / capabilities having numeric ids that are only valid
for the owning process, they are now global in a system capabilities
table. This will allow for specifying capabilities in IPC that doesn't
need to be kernel-controlled.

Processes will still need to be granted access to given capabilities,
but that can become a simpler system call than the current method of
sending them through mailbox messages (and worse, having to translate
every one into a new capability like was the case before). In order to
track which handles a process has access to, a new node_set based on
node_map allows for an efficient storage and lookup of handles.
This commit is contained in:
Justin C. Miller
2022-10-10 21:19:25 -07:00
parent 41bb97b179
commit 9ac4e51224
27 changed files with 337 additions and 383 deletions

View File

@@ -1,5 +1,6 @@
#include <util/pointers.h>
#include "capabilities.h"
#include "cpu.h"
#include "logger.h"
#include "memory.h"
@@ -31,7 +32,8 @@ thread::thread(process &parent, uint8_t pri, uintptr_t rsp0) :
m_tcb.rsp0 = rsp0;
m_creator = current_cpu().thread;
m_self_handle = parent.add_handle(this, thread::parent_caps);
m_self_handle = g_cap_table.create(this, thread::parent_caps);
parent.add_handle(m_self_handle);
}
thread::~thread()