pub unsafe fn create(
        domain: ProtectionDomain,
        entry: VirtAddr,
        first_arg: usize,
    ) -> Result<Thread, MemoryError> {
        // TODO: lazily allocate in the future?
        let stack_guard_size: usize = AMOUNT_GUARD_PAGES * PAGE_SIZE;
        let stack = {
            preempt_disable();
            let guard = domain.temporarily_switch();
            let mut stack = Stack::create(&domain, STACK_SIZE, stack_guard_size)?;
            stack.prepare_trampoline(entry, first_arg);
            drop(guard);
            preempt_enable();
            stack
        };
        Ok(Self::new(stack, domain))
    }
/// Creates a thread.
/// Unsafe because it's possible to set an entry point.
Creates a thread.
Unsafe because it's possible to set an entry point.
Creates a thread . Unsafe because it ' s possible to set an entry point .
pub unsafe fn create(
        domain: ProtectionDomain,
        entry: VirtAddr,
        first_arg: usize,
    ) -> Result<Thread, MemoryError> {
        // TODO: lazily allocate in the future?
        let stack_guard_size: usize = AMOUNT_GUARD_PAGES * PAGE_SIZE;
        let stack = {
            preempt_disable();
            let guard = domain.temporarily_switch();
            let mut stack = Stack::create(&domain, STACK_SIZE, stack_guard_size)?;
            stack.prepare_trampoline(entry, first_arg);
            drop(guard);
            preempt_enable();
            stack
        };
        Ok(Self::new(stack, domain))
    }
pub unsafe fn create ( domain : ProtectionDomain , entry : VirtAddr , first_arg : usize , ) -> Result < Thread , MemoryError > { // TODO: lazily allocate in the future? let stack_guard_size : usize = AMOUNT_GUARD_PAGES * PAGE_SIZE ; let stack = { preempt_disable ( ) ; let guard = domain . temporarily_switch ( ) ; let mut stack = Stack :: create ( & domain , STACK_SIZE , stack_guard_size ) ? ; stack . prepare_trampoline ( entry , first_arg ) ; drop ( guard ) ; preempt_enable ( ) ; stack } ; Ok ( Self :: new ( stack , domain ) ) }
Creates a thread.
Creates a thread .
domain
ProtectionDomain
entry
VirtAddr
first_arg
usize
domain
ProtectionDomain
entry
VirtAddr
first_arg
usize