Irq_user处理从用户态进入中断的场景该流程分支主要分为三部分:
调用usr_entry保存用户态的堆栈
调用irq_handler处理中断事务,这个函数在之前已经分析过,就是读取中断号,然后调用Linux内核相关的处理流程
最后调用ret_to_user恢复用户太的堆栈,并且返回用户态。
__irq_usr: usr_entry kuser_cmpxchg_check #ifdef CONFIG_TRACE_IRQFLAGS bl trace_hardirqs_off #endif get_thread_info tsk #ifdef CONFIG_PREEMPT ldr r8, [tsk, #TI_PREEMPT] @ get preempt count add r7, r8, #1 @ increment it str r7, [tsk, #TI_PREEMPT] #endif irq_handler #ifdef CONFIG_PREEMPT ldr r0, [tsk, #TI_PREEMPT] str r8, [tsk, #TI_PREEMPT] teq r0, r7 strne r0, [r0, -r0] #endif #ifdef CONFIG_TRACE_IRQFLAGS bl trace_hardirqs_on #endif mov why, #0 b ret_to_user ENDPROC(__irq_usr) |
User_entry处理过程
.macro usr_entry sub sp, sp, #S_FRAME_SIZE stmib sp, {r1 - r12} ldmia r0, {r1 - r3} add r0, sp, #S_PC @ here for interlock avoidance mov r4, #-1 @ "" "" "" "" str r1, [sp] @ save the "real" r0 copied @ from the exception stack @ @ We are now ready to fill in the remaining blanks on the stack: @ @ r2 - lr_, already fixed up for correct return/restart @ r3 - spsr_ @ r4 - orig_r0 (see pt_regs definition in ptrace.h) @ @ Also, separately save sp_usr and lr_usr @ stmia r0, {r2 - r4} stmdb r0, {sp, lr}^ |
Ret_from_user处理过程
MicrosoftInternetExplorer402DocumentNotSpecified7.8Normal0
ENTRY(ret_to_user) ret_slow_syscall: disable_irq @ disable interrupts ldr r1, [tsk, #TI_FLAGS] tst r1, #_TIF_WORK_MASK bne work_pending no_work_pending: /* perform architecture specific actions before user return */ arch_ret_to_user r1, lr @ slow_restore_user_regs ldr r1, [sp, #S_PSR] @ get calling cpsr ldr lr, [sp, #S_PC]! @ get pc msr spsr_cxsf, r1 @ save in spsr_svc ldmdb sp, {r0 - lr}^ @ get calling r0 - lr mov r0, r0 add sp, sp, #S_FRAME_SIZE - S_PC movs pc, lr @ return & move spsr_svc into cpsr ENDPROC(ret_to_user) |
阅读(2529) | 评论(0) | 转发(1) |