aboutsummaryrefslogtreecommitdiff
path: root/src/defs.rs
diff options
context:
space:
mode:
authorTianhao Wang <shrik3@mailbox.org>2024-06-06 02:08:21 +0200
committerTianhao Wang <shrik3@mailbox.org>2024-06-11 15:17:14 +0200
commitd495a1745c83a8186bf1c6c531177887dd245436 (patch)
tree5ea93adceea22d7aa12eb0165fce80e458dd3864 /src/defs.rs
parenta86f59b32eb86a1ccb94bf1e627c1115c3b6b217 (diff)
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 <shrik3@mailbox.org>
Diffstat (limited to 'src/defs.rs')
-rw-r--r--src/defs.rs5
1 files changed, 5 insertions, 0 deletions
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