mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[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:
@@ -5,6 +5,7 @@
|
||||
#include <util/no_construct.h>
|
||||
|
||||
#include "assert.h"
|
||||
#include "capabilities.h"
|
||||
#include "device_manager.h"
|
||||
#include "frame_allocator.h"
|
||||
#include "heap_allocator.h"
|
||||
@@ -31,6 +32,9 @@ uintptr_t g_slabs_bump_pointer;
|
||||
static util::no_construct<heap_allocator> __g_kernel_heap_storage;
|
||||
heap_allocator &g_kernel_heap = __g_kernel_heap_storage.value;
|
||||
|
||||
static util::no_construct<cap_table> __g_cap_table_storage;
|
||||
cap_table &g_cap_table = __g_cap_table_storage.value;
|
||||
|
||||
static util::no_construct<frame_allocator> __g_frame_allocator_storage;
|
||||
frame_allocator &g_frame_allocator = __g_frame_allocator_storage.value;
|
||||
|
||||
@@ -40,6 +44,9 @@ obj::vm_area_untracked &g_kernel_heap_area = __g_kernel_heap_area_storage.value;
|
||||
static util::no_construct<obj::vm_area_untracked> __g_kernel_heapmap_area_storage;
|
||||
obj::vm_area_untracked &g_kernel_heapmap_area = __g_kernel_heapmap_area_storage.value;
|
||||
|
||||
static util::no_construct<obj::vm_area_untracked> __g_cap_table_area_storage;
|
||||
obj::vm_area_untracked &g_cap_table_area = __g_cap_table_area_storage.value;
|
||||
|
||||
static util::no_construct<obj::vm_area_guarded> __g_kernel_stacks_storage;
|
||||
obj::vm_area_guarded &g_kernel_stacks = __g_kernel_stacks_storage.value;
|
||||
|
||||
@@ -104,6 +111,13 @@ memory_initialize_pre_ctors(bootproto::args &kargs)
|
||||
|
||||
new (&g_kernel_heap) heap_allocator {mem::heap_offset, mem::heap_size, mem::heapmap_offset};
|
||||
|
||||
obj::vm_area *caps = new (&g_cap_table_area)
|
||||
obj::vm_area_untracked(mem::caps_size, vm_flags::write);
|
||||
|
||||
vm.add(mem::caps_offset, caps);
|
||||
|
||||
new (&g_cap_table) cap_table {mem::caps_offset};
|
||||
|
||||
obj::vm_area *stacks = new (&g_kernel_stacks) obj::vm_area_guarded {
|
||||
mem::stacks_offset,
|
||||
mem::kernel_stack_pages,
|
||||
|
||||
Reference in New Issue
Block a user