summaryrefslogtreecommitdiff
path: root/include/kernel/proc.h
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-01-03 02:19:57 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-01-03 02:19:57 +0800
commit210025560c80b48af4875af199f183ad709e3bf0 (patch)
treeeb11aeb7b641187f207e3b572c5184cf3526b463 /include/kernel/proc.h
parentbde87490d61135dcaa94d9b1489ff6c39876d169 (diff)
parent10614e04929a6d109a5e90524e446b637aaf0c13 (diff)
downloadlume-210025560c80b48af4875af199f183ad709e3bf0.tar.gz
lume-210025560c80b48af4875af199f183ad709e3bf0.tar.xz
Merge pull request #4 from Richard-Qin-001/dev/shell
Rebuilt the system's underlying structure; it is now stable enough to merge. The system now supports a read-only file system and has a simple shell implemented.
Diffstat (limited to 'include/kernel/proc.h')
-rw-r--r--include/kernel/proc.h55
1 files changed, 5 insertions, 50 deletions
diff --git a/include/kernel/proc.h b/include/kernel/proc.h
index b557267..cbf2902 100644
--- a/include/kernel/proc.h
+++ b/include/kernel/proc.h
@@ -1,56 +1,8 @@
#pragma once
#include "common/types.h"
-#include "kernel/trap.h"
+#include "kernel/proc_def.h"
#include "kernel/spinlock.h"
-struct Context
-{
- uint64 ra;
- uint64 sp;
-
- uint64 s0;
- uint64 s1;
- uint64 s2;
- uint64 s3;
- uint64 s4;
- uint64 s5;
- uint64 s6;
- uint64 s7;
- uint64 s8;
- uint64 s9;
- uint64 s10;
- uint64 s11;
-};
-
-enum ProcState{
- UNUSED,
- USED,
- SLEEPING,
- RUNNABLE,
- RUNNING,
- ZOMBIE,
-};
-
-struct Proc
-{
- struct Context context;
- struct Trapframe *tf;
-
- uint64 *pagetable;
-
- enum ProcState state;
- int pid;
-
- void* kstack;
- char name[16];
- uint64 sz;
-
- struct Proc *parent;
- void *chan;
- int xstate;
-};
-
-
namespace ProcManager
{
void init();
@@ -62,8 +14,11 @@ namespace ProcManager
void user_init();
void exit(int status);
int wait(uint64 addr);
- void sleep(void *chan, struct spinlock *lk);
+
+ void sleep(void *chan, Spinlock *lk);
void wakeup(void *chan);
+
+ int growproc(int n);
}
void forkret();