43 lines
1.1 KiB
Rust
43 lines
1.1 KiB
Rust
#![allow(dead_code)]
|
|
#![allow(unused_imports)]
|
|
|
|
use crate::memory::MemoryRegion;
|
|
|
|
use lazy_static;
|
|
|
|
extern crate alloc;
|
|
use alloc::vec::Vec;
|
|
use alloc::string::String;
|
|
|
|
pub struct ProcessTable {}
|
|
|
|
pub struct Process {
|
|
/// Unique process ID.
|
|
proc_id: u32,
|
|
/// ID of the parent process.
|
|
parent_proc_id: u32,
|
|
/// List of all child processes.
|
|
child_proc_ids: Vec<u32>,
|
|
/// Human readable name of the process, should be the command.
|
|
name: String,
|
|
/// The base address of the process stack within its memory region.
|
|
stack_base_addr: usize,
|
|
/// The length of the stack. This, plus the start address, is the stack size.
|
|
stack_length: usize,
|
|
/// The stack pointer, which is relative to the memory region start.
|
|
stack_ptr: usize,
|
|
/// The region of memory allocated to the process.
|
|
mem_region: MemoryRegion,
|
|
/// Process priority. Lower number is higher priority.
|
|
prio: u16,
|
|
/// Which semaphor the process is waiting on.
|
|
semaphor_wait: Option<u32>,
|
|
}
|
|
|
|
pub enum ProcessState {
|
|
RUNNING,
|
|
WAITING,
|
|
SLEEPING,
|
|
SUSPENDED,
|
|
|
|
} |