diff options
| author | Tianhao Wang <shrik3@mailbox.org> | 2024-06-05 08:01:45 +0200 |
|---|---|---|
| committer | Tianhao Wang <shrik3@mailbox.org> | 2024-06-11 15:17:13 +0200 |
| commit | 469d1ed261943fb312767c0052ac1b09f06d6cd5 (patch) | |
| tree | 2c266cf47515e0b0d901507aee045467bc294b80 | |
| parent | 2c4366a804ae6c389614ff8da9b0225ffb6ce14a (diff) | |
proc: add basic task struct
Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
| -rw-r--r-- | src/lib.rs | 1 | ||||
| -rw-r--r-- | src/proc/mod.rs | 1 | ||||
| -rw-r--r-- | src/proc/task.rs | 13 |
3 files changed, 15 insertions, 0 deletions
@@ -11,6 +11,7 @@ mod io; mod machine; mod mm; use crate::machine::key::Modifiers; +mod proc; use arch::x86_64::interrupt; use arch::x86_64::interrupt::pic_8259; use arch::x86_64::interrupt::pic_8259::PicDeviceInt; diff --git a/src/proc/mod.rs b/src/proc/mod.rs new file mode 100644 index 0000000..cdafe4a --- /dev/null +++ b/src/proc/mod.rs @@ -0,0 +1 @@ +pub mod task; diff --git a/src/proc/task.rs b/src/proc/task.rs new file mode 100644 index 0000000..0ff2065 --- /dev/null +++ b/src/proc/task.rs @@ -0,0 +1,13 @@ +use crate::arch::x86_64::arch_regs; + +/// currently only kernelSp and Context are important. +/// the task struct will be placed on the starting addr (low addr) of the kernel stack. +/// therefore we can retrive the task struct at anytime by masking the kernel stack +#[repr(C)] +#[repr(packed)] +pub struct Task { + pub task_id: u32, + pub kernel_stack: u64, + pub user_stack: u64, + pub context: arch_regs::Context64, +} |
