[][src]Function sunrise_kernel::scheduler::scheduler_first_schedule

pub unsafe fn scheduler_first_schedule<F: FnOnce()>(
    current_thread: Arc<ThreadStruct>,
    jump_to_entrypoint: F
)

The function called when a thread was scheduled for the first time, right after the arch-specific process switch was performed.

It takes a reference to the current thread (which will be set), and a function that should jump to this thread's entrypoint.

The passed function should take care to change the protection level, and ensure it cleans up all the registers before calling the EIP, in order to avoid leaking information to userspace.

Safety

Interrupts must be off when calling this function. It will set CURRENT_THREAD, and then turn them on, as we are running a new thread, no SpinLockIRQ is held.