1. 程式人生 > >搶占在中斷中的判斷

搶占在中斷中的判斷

res path jmp clas cmp and call stack paths

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

搶占在中斷中的判斷