24 lines
794 B
Rust
24 lines
794 B
Rust
#![no_std]
|
|
|
|
use domain::{memory::MemoryRegion, thread::SavedContext};
|
|
use types::{
|
|
address::{EntryPoint, StackPointer},
|
|
id::{CoreId, IrqId, ProcessId},
|
|
time::{Ticks, TimerDuration},
|
|
};
|
|
|
|
pub trait PlatformContext: Copy + Default {}
|
|
|
|
pub trait Platform {
|
|
fn configure_protection(&mut self, process: ProcessId, regions: &[MemoryRegion]);
|
|
fn context_switch(&mut self, from: &mut SavedContext, to: &SavedContext);
|
|
fn enable_user_mode(&mut self, entry: EntryPoint, stack: StackPointer) -> !;
|
|
fn set_timer(&mut self, duration: TimerDuration);
|
|
fn current_ticks(&self) -> Ticks;
|
|
fn mask_irq(&mut self, irq: IrqId);
|
|
fn unmask_irq(&mut self, irq: IrqId);
|
|
fn send_ipi(&mut self, target: CoreId);
|
|
fn core_id(&self) -> CoreId;
|
|
fn num_cores(&self) -> u8;
|
|
}
|