pub trait Platform: Sized + 'static {
type PageTableSize: FrameSize;
type PageTable: PageTable<Self::PageTableSize> + Send;
type TaskContext;
// Required methods
fn new_task_context(
kernel_stack: &Stack,
user_stack: &Stack,
task_entry_point: VAddr,
) -> Self::TaskContext;
unsafe fn context_switch(
from_context: *mut Self::TaskContext,
to_context: *const Self::TaskContext,
);
unsafe fn drop_into_userspace(context: *const Self::TaskContext) -> !;
unsafe fn write_to_phys_memory(address: PAddr, data: &[u8]);
}
Required Associated Types§
type PageTableSize: FrameSize
type PageTable: PageTable<Self::PageTableSize> + Send
type TaskContext
Required Methods§
Sourcefn new_task_context(
kernel_stack: &Stack,
user_stack: &Stack,
task_entry_point: VAddr,
) -> Self::TaskContext
fn new_task_context( kernel_stack: &Stack, user_stack: &Stack, task_entry_point: VAddr, ) -> Self::TaskContext
Create a TaskContext
for a new task with the supplied kernel and user stacks.
Sourceunsafe fn context_switch(
from_context: *mut Self::TaskContext,
to_context: *const Self::TaskContext,
)
unsafe fn context_switch( from_context: *mut Self::TaskContext, to_context: *const Self::TaskContext, )
Do the arch-dependent part of the context switch. This should save the context of the
currently running task into from_context
, and restore to_context
to start executing.
Sourceunsafe fn drop_into_userspace(context: *const Self::TaskContext) -> !
unsafe fn drop_into_userspace(context: *const Self::TaskContext) -> !
Do the actual drop into usermode. This assumes that the task’s page tables have already been installed.
unsafe fn write_to_phys_memory(address: PAddr, data: &[u8])
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.