vm: implement private and shared address space mappings

whether a mapping is private or shared determines how the mapping is handled
when a task is duplicated.
This commit is contained in:
2026-04-21 21:12:00 +01:00
parent 8b7382fa13
commit 278fe39c0d
9 changed files with 63 additions and 24 deletions
+8 -8
View File
@@ -148,8 +148,8 @@ kern_status_t sys_vm_controller_create_object(
}
kern_status_t status = KERN_OK;
unsigned long flags;
task_lock_irqsave(self, &flags);
unsigned long irq_flags;
task_lock_irqsave(self, &irq_flags);
struct object *ctrl_obj = NULL;
handle_flags_t handle_flags = 0;
@@ -159,7 +159,7 @@ kern_status_t sys_vm_controller_create_object(
&ctrl_obj,
&handle_flags);
if (status != KERN_OK) {
task_unlock_irqrestore(self, flags);
task_unlock_irqrestore(self, irq_flags);
put_current_task(self);
return status;
}
@@ -173,14 +173,14 @@ kern_status_t sys_vm_controller_create_object(
&out_handle);
struct vm_controller *ctrl = vm_controller_cast(ctrl_obj);
task_unlock_irqrestore(self, flags);
task_unlock_irqrestore(self, irq_flags);
if (!ctrl) {
object_unref(ctrl_obj);
put_current_task(self);
return KERN_INVALID_ARGUMENT;
}
vm_controller_lock_irqsave(ctrl, &flags);
vm_controller_lock_irqsave(ctrl, &irq_flags);
struct vm_object *out_vmo = NULL;
status = vm_controller_create_object(
ctrl,
@@ -190,14 +190,14 @@ kern_status_t sys_vm_controller_create_object(
data_len,
prot,
&out_vmo);
vm_controller_unlock_irqrestore(ctrl, flags);
vm_controller_unlock_irqrestore(ctrl, irq_flags);
object_unref(ctrl_obj);
if (status != KERN_OK) {
task_lock_irqsave(self, &flags);
task_lock_irqsave(self, &irq_flags);
handle_table_free_handle(self->t_handles, out_handle);
task_unlock_irqrestore(self, flags);
task_unlock_irqrestore(self, irq_flags);
put_current_task(self);
return status;
}