mirror of
https://github.com/XunilGroup/XunilOS.git
synced 2026-06-02 12:44:24 +02:00
925b2bc8d2
fix munmap number, remove the draw calls, make address space an option, copy only the top 256 bytes of the HHDM and map the ELF code inside userspace, add safe copying from userspace
42 lines
847 B
Rust
42 lines
847 B
Rust
use alloc::vec::Vec;
|
|
|
|
use crate::{driver::keyboard::KeyboardEvent, mm::address_space::AddressSpace};
|
|
|
|
pub enum ProcessState {
|
|
Ready,
|
|
Running,
|
|
Blocked,
|
|
Zombie,
|
|
}
|
|
|
|
pub struct Process {
|
|
pub pid: u64,
|
|
pub state: ProcessState,
|
|
pub stack_top: u64,
|
|
pub heap_base: u64,
|
|
pub heap_end: u64,
|
|
pub kbd_buffer: Vec<KeyboardEvent>,
|
|
pub address_space: Option<AddressSpace>,
|
|
pub user_entry: u64,
|
|
}
|
|
impl Process {
|
|
pub fn new(
|
|
pid: u64,
|
|
user_entry: u64,
|
|
stack_top: u64,
|
|
heap_base: u64,
|
|
heap_end: u64,
|
|
) -> Process {
|
|
Process {
|
|
pid,
|
|
stack_top,
|
|
state: ProcessState::Ready,
|
|
heap_base,
|
|
heap_end,
|
|
kbd_buffer: Vec::new(),
|
|
address_space: None,
|
|
user_entry,
|
|
}
|
|
}
|
|
}
|