src/kernel/task/preempt.c
/**
 * @note : this function is invoked
 *         when before exit trap from user mode.
 *         Must invoked with irq disabled,
 *         and will return with irq disabled.
 */
@note : this function is invoked
when before exit trap from user mode.
Must invoked with irq disabled,
and will return with irq disabled.
@note : this function is invoked when before exit trap from user mode . Must invoked with irq disabled and will return with irq disabled .
void preempt_schedule_user_preempt(){
    if(GET_RUNNING_THREAD()->preempt_cnt==0&&threads_get_resched()&&intr_disabled()){
        do {
            preempt_disable();
            intr_on();
            __scheduler_core();
            intr_off();
            preempt_enable_noresched();
        } while (threads_get_resched());
    }
}
void preempt_schedule_user_preempt ( ) { if ( GET_RUNNING_THREAD ( ) -> preempt_cnt == 0 && threads_get_resched ( ) && intr_disabled ( ) ) { do { preempt_disable ( ) ; intr_on ( ) ; __scheduler_core ( ) ; intr_off ( ) ; preempt_enable_noresched ( ) ; } while ( threads_get_resched ( ) ) ; } }
@note : this function is invoked
         when before exit trap from user mode.
@note : this function is invoked when before exit trap from user mode .