Implement Mutexes and supporting syscalls, cleanup/optimize scheduler
All checks were successful
Build documentation / build-and-deploy (push) Successful in 39s

This commit is contained in:
2026-01-10 00:12:42 +01:00
parent 6a474c21a0
commit 41a458b925
17 changed files with 276 additions and 73 deletions

View File

@@ -240,15 +240,11 @@ uintptr_t mm_alloc_user_pd_phys (void) {
/* Reload after map/unmap operation was performed. This function does the TLB shootdown. */
void mm_reload (void) {
spin_lock (&mm_lock);
struct limine_mp_response* mp = limine_mp_request.response;
for (size_t i = 0; i < mp->cpu_count; i++) {
amd64_lapic_ipi (mp->cpus[i]->lapic_id, TLB_SHOOTDOWN);
}
spin_unlock (&mm_lock);
}
bool mm_validate (struct pd* pd, uintptr_t vaddr, uint32_t flags) {

View File

@@ -50,7 +50,7 @@ struct proc* proc_from_elf (uint8_t* elf_contents) {
struct proc_resource* ustk_r =
proc_create_resource (proc, ustk_rid, PR_MEM, RV_PRIVATE, (void*)&ustk_mem_init);
if (ustk_r == NULL) {
kstk_r->ops.cleanup (kstk_r);
kstk_r->ops.cleanup (proc, kstk_r);
free (kstk_r);
free (proc);
return NULL;

View File

@@ -8,7 +8,7 @@
#include <libk/string.h>
#include <limine/requests.h>
#include <mm/liballoc.h>
#include <sync/rw_spin_lock.h>
#include <sync/spin_lock.h>
#include <sys/debug.h>
#include <sys/smp.h>
#include <sys/syscall.h>
@@ -27,7 +27,7 @@ struct cpu* cpu_make (void) {
struct cpu* cpu = &cpus[id];
memset (cpu, 0, sizeof (*cpu));
cpu->lock = RW_SPIN_LOCK_INIT;
cpu->lock = SPIN_LOCK_INIT;
cpu->id = id;
cpu->self = cpu;

View File

@@ -7,7 +7,7 @@
#include <libk/rbtree.h>
#include <libk/std.h>
#include <proc/proc.h>
#include <sync/rw_spin_lock.h>
#include <sync/spin_lock.h>
#define CPUS_MAX 32
@@ -30,7 +30,7 @@ struct cpu {
atomic_int nesting;
} irq_ctx;
rw_spin_lock_t lock;
spin_lock_t lock;
struct rb_node_link* proc_run_q;
struct proc* proc_current;