vm: replace vm-region with address-space

address-space is a non-recursive data structure, which contains a flat list of vm_areas representing
mapped vm-objects.

userspace programs can no longer create sub-address-spaces. instead, they can reserve portions of
the address space, and use that reserved space to create mappings.
This commit is contained in:
2026-03-13 19:44:50 +00:00
parent c6b0bee827
commit c628390f4a
28 changed files with 1719 additions and 2612 deletions

View File

@@ -1,3 +1,4 @@
#include <kernel/address-space.h>
#include <kernel/channel.h>
#include <kernel/clock.h>
#include <kernel/cpu.h>
@@ -10,7 +11,6 @@
#include <kernel/task.h>
#include <kernel/thread.h>
#include <kernel/util.h>
#include <kernel/vm-region.h>
#define TASK_CAST(p) OBJECT_C_CAST(struct task, t_base, &task_type, p)
@@ -95,15 +95,6 @@ kern_status_t setup_kernel_task(void)
__kernel_task->t_state = TASK_RUNNING;
__kernel_task->t_pmap = get_kernel_pmap();
vm_region_create(
NULL,
"root",
4,
VM_KERNEL_BASE,
VM_KERNEL_LIMIT - VM_KERNEL_BASE,
VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXEC | VM_PROT_SVR,
&__kernel_task->t_address_space);
snprintf(
__kernel_task->t_name,
sizeof __kernel_task->t_name,
@@ -195,16 +186,12 @@ struct task *task_create(const char *name, size_t name_len)
task->t_id = pid_alloc();
task->t_pmap = pmap;
vm_region_create(
NULL,
"root",
4,
address_space_create(
VM_USER_BASE,
VM_USER_LIMIT - VM_USER_BASE,
VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXEC | VM_PROT_USER,
VM_USER_LIMIT,
&task->t_address_space);
task->t_address_space->vr_pmap = pmap;
task->t_address_space->s_pmap = pmap;
task->t_state = TASK_RUNNING;
task->t_handles = handle_table_create();