pub trait ThreadState: 'static + Sized {
type MemoryConfig: MemoryConfig;
const NEW: Self;
// Required methods
unsafe fn initialize_kernel_state(
&mut self,
kernel_stack: Stack,
memory_config: *const Self::MemoryConfig,
initial_function: extern "C" fn(usize, usize, usize),
args: (usize, usize, usize),
);
unsafe fn initialize_user_state(
&mut self,
kernel_stack: Stack,
memory_config: *const Self::MemoryConfig,
initial_sp: usize,
initial_pc: usize,
args: (usize, usize, usize),
) -> Result<()>;
}Required Associated Constants§
Required Associated Types§
type MemoryConfig: MemoryConfig
Required Methods§
Sourceunsafe fn initialize_kernel_state(
&mut self,
kernel_stack: Stack,
memory_config: *const Self::MemoryConfig,
initial_function: extern "C" fn(usize, usize, usize),
args: (usize, usize, usize),
)
unsafe fn initialize_kernel_state( &mut self, kernel_stack: Stack, memory_config: *const Self::MemoryConfig, initial_function: extern "C" fn(usize, usize, usize), args: (usize, usize, usize), )
Initialize the default frame of a kernel thread
Arranges for the thread to start at initial_function with arguments
passed in the first two argument slots. The stack pointer of the thread
is set to the top of the kernel stack.
§Safety
Caller guarantees that the memory_config pointer remains valid for the
lifetime of the thread.
§Implementation Note
The implementation is responsible for ensuring that initial_function
is called with interrupts enabled and without the scheduler lock held.
This call must initialize the ThreadLocalState returned by
thread_local_state().
Sourceunsafe fn initialize_user_state(
&mut self,
kernel_stack: Stack,
memory_config: *const Self::MemoryConfig,
initial_sp: usize,
initial_pc: usize,
args: (usize, usize, usize),
) -> Result<()>
unsafe fn initialize_user_state( &mut self, kernel_stack: Stack, memory_config: *const Self::MemoryConfig, initial_sp: usize, initial_pc: usize, args: (usize, usize, usize), ) -> Result<()>
Initialize the default frame of a user thread
Arranges for the thread to start at initial_function with arguments
passed in the first two argument slots
§Safety
Caller guarantees that the memory_config pointer remains valid for the
lifetime of the thread.
§Implementation Note
The implementation is responsible for ensuring that initial_function
is called with interrupts enabled, memory_config enabled, non-privileged
mode, and without the scheduler lock held.
This call must initialize the ThreadLocalState returned by
thread_local_state().
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".