[Add] laos base boot

This commit is contained in:
bLueriVerLHR
2023-05-21 00:48:04 +08:00
parent 5d31bf294c
commit 029a8823f4
34 changed files with 927 additions and 18 deletions

24
laos/src/kernel/proc.c Normal file
View File

@@ -0,0 +1,24 @@
#include "proc.h"
#include "la32r.h"
#include "latype.h"
struct cpu cpus[NCPU];
struct proc proc[NPROC];
struct proc *initproc;
int nextpid = 1;
struct spinlock pid_lock;
// helps ensure that wakeups of wait()ing
// parents are not lost. helps obey the
// memory model when using p->parent.
// must be acquired before any p->lock.
struct spinlock wait_lock;
struct cpu *mycpu() {
int id = r_cpuid();
struct cpu *c = &cpus[id];
return c;
}