kernel

Trait Platform

Source
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§

Required Methods§

Source

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.

Source

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.

Source

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.

Source

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.

Implementors§