码迷,mamicode.com
首页 > 其他好文 > 详细

抢占在中断中的判断

时间:2017-12-13 14:53:55      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:tin   post   move   gpo   and   use   cal   flags   eem   

ret_from_intr:
    DISABLE_INTERRUPTS(CLBR_ANY)
    TRACE_IRQS_OFF

    LEAVE_IRQ_STACK

    testb    $3, CS(%rsp)
    jz    retint_kernel

    /* Interrupt came from user space */
GLOBAL(retint_user)
    mov    %rsp,%rdi
    call    prepare_exit_to_usermode
    TRACE_IRQS_IRETQ
    SWAPGS
    jmp    restore_regs_and_iret

/* Returning to kernel space */
retint_kernel:
#ifdef CONFIG_PREEMPT
    /* Interrupts are off */
    /* Check if we need preemption */
    bt    $9, EFLAGS(%rsp)        /* were interrupts off? */
    jnc    1f
0:    cmpl    $0, PER_CPU_VAR(__preempt_count)
    jnz    1f
    call    preempt_schedule_irq
    jmp    0b
1:
#endif
    /*
     * The iretq could re-enable interrupts:
     */
    TRACE_IRQS_IRETQ

/*
 * At this label, code paths which return to kernel and to user,
 * which come from interrupts/exception and from syscalls, merge.
 */
GLOBAL(restore_regs_and_iret)
    RESTORE_EXTRA_REGS
restore_c_regs_and_iret:
    RESTORE_C_REGS
    REMOVE_PT_GPREGS_FROM_STACK 8
    INTERRUPT_RETURN

//4.14.5

抢占在中断中的判断

标签:tin   post   move   gpo   and   use   cal   flags   eem   

原文地址:http://www.cnblogs.com/fluray/p/8032155.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!