Major restructure

This commit is contained in:
Imbus 2025-09-01 22:22:35 +02:00
parent 0562c2fe5a
commit c52e19de83
25 changed files with 574 additions and 188 deletions

21
kern/libkern/proc.c Normal file
View file

@ -0,0 +1,21 @@
#include <proc.h>
struct Cpu cpus[NCPU];
/**
* Must be called with interrupts disabled, to prevent race with process being
* moved to a different CPU.
*/
int cpuid() {
int id = read_tp();
return id;
}
/**
* Return this CPU's cpu struct. Interrupts must be disabled.
*/
struct Cpu *mycpu(void) {
int id = cpuid();
struct Cpu *c = &cpus[id];
return c;
}