summaryrefslogtreecommitdiff
path: root/src/kernel/proc/proc.cc
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2025-12-28 01:48:50 +0800
committerRichard Qin <richard.qin.x@gmail.com>2025-12-28 01:48:50 +0800
commitf3c8918b13a5226f53e7870d60436f812e5d9015 (patch)
tree5a934b82f23916e67e8cac9d230af93645611f3a /src/kernel/proc/proc.cc
parenta82ab8ad6d277ededc128678aebabf5fbdb01c45 (diff)
downloadlume-f3c8918b13a5226f53e7870d60436f812e5d9015.tar.gz
lume-f3c8918b13a5226f53e7870d60436f812e5d9015.tar.xz
feat(user): add user-space build system and init process to test fork/wait
Diffstat (limited to 'src/kernel/proc/proc.cc')
-rw-r--r--src/kernel/proc/proc.cc15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/kernel/proc/proc.cc b/src/kernel/proc/proc.cc
index 15a28b4..008f740 100644
--- a/src/kernel/proc/proc.cc
+++ b/src/kernel/proc/proc.cc
@@ -23,13 +23,8 @@ struct spinlock proc_lock;
int nextpid = 1;
-
-uchar initcode[] = {
- 0x13, 0x05, 0x50, 0x05, // li a0, 85 ('U')
- 0x93, 0x08, 0x10, 0x00, // li a7, 1 (SYS_putc)
- 0x73, 0x00, 0x00, 0x00, // ecall
- 0x6f, 0xf0, 0x5f, 0xff // j loop (-12)
-};
+extern char initcode_start[];
+extern char initcode_end[];
struct Proc *myproc()
{
@@ -277,7 +272,9 @@ namespace ProcManager
}
p->pagetable = VM::uvmcreate();
- VM::uvminit(p->pagetable, initcode, sizeof(initcode));
+
+ uint64 initcode_sz = initcode_end - initcode_start;
+ VM::uvminit(p->pagetable, (uchar *)initcode_start, initcode_sz);
p->sz = PGSIZE;
if (VM::mappages(p->pagetable, TRAPFRAME, PGSIZE,
@@ -402,6 +399,6 @@ namespace ProcManager
}
}
-
+
} \ No newline at end of file