41 lines
1.2 KiB
Rust
41 lines
1.2 KiB
Rust
#![no_std]
|
|
|
|
use domain::memory::MemoryRegion;
|
|
use types::{
|
|
address::{EntryPoint, PhysicalAddress, StackPointer, VirtualAddress},
|
|
bounded::PageCount,
|
|
id::{CoreId, IrqId, ProcessId},
|
|
permission::PermissionSet,
|
|
time::{Ticks, TimerDuration},
|
|
};
|
|
|
|
pub trait Platform {
|
|
fn configure_protection(&mut self, process: ProcessId, regions: &[MemoryRegion]);
|
|
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;
|
|
fn map_shared(
|
|
&mut self,
|
|
process: ProcessId,
|
|
base: PhysicalAddress,
|
|
size: PageCount,
|
|
permissions: PermissionSet,
|
|
);
|
|
fn halt(&self) -> !;
|
|
fn debug_putchar(&self, byte: u8);
|
|
fn translate_va(&self, process: ProcessId, va: VirtualAddress) -> Option<PhysicalAddress>;
|
|
fn map_user_page(
|
|
&mut self,
|
|
process: ProcessId,
|
|
va: VirtualAddress,
|
|
pa: PhysicalAddress,
|
|
writable: bool,
|
|
executable: bool,
|
|
);
|
|
}
|