From d495a1745c83a8186bf1c6c531177887dd245436 Mon Sep 17 00:00:00 2001 From: Tianhao Wang Date: Thu, 6 Jun 2024 02:08:21 +0200 Subject: proc: basic infra for multithreading including task and scheduler wrapper, context swap assembly, and some notes... The lifetime of task is tricky, I'll fix it later Signed-off-by: Tianhao Wang --- src/defs.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/defs.rs') diff --git a/src/defs.rs b/src/defs.rs index d9a15b5..83ba487 100644 --- a/src/defs.rs +++ b/src/defs.rs @@ -82,6 +82,11 @@ impl Mem { // (64 GiB) pub const KERNEL_HEAP_START: u64 = 0xffff_8030_0000_0000; pub const KERNEL_HEAP_END: u64 = 0xffff_8040_0000_0000; + // unlike the initial "thread" that has 64K stack, new tasks have 4 pages of + // kernel stack. + pub const KERNEL_STACK_SIZE: u64 = 0x4000; + pub const KERNEL_STACK_MASK: u64 = Self::KERNEL_STACK_SIZE - 1; + pub const KERNEL_STACK_TASK_MAGIC: u64 = 0x1A2B3C4D5E6F6969; } // convert VA <-> PA wrt. the kernel id mapping -- cgit v1.2.3-70-g09d2