]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - arch/x86_64/kernel/entry.S
[PATCH] x86_64: Switch to the interrupt stack when running a softirq in local_bh_enable()
[linux-2.6.git] / arch / x86_64 / kernel / entry.S
index 1086b5fcac21c51ad8acb01a02c6c8a6a971a8c7..096d470e280f38d6e64eb179a23525ecaa1252e5 100644 (file)
@@ -76,7 +76,7 @@
 
        .macro FAKE_STACK_FRAME child_rip
        /* push in order ss, rsp, eflags, cs, rip */
-       xorq %rax, %rax
+       xorl %eax, %eax
        pushq %rax /* ss */
        CFI_ADJUST_CFA_OFFSET   8
        pushq %rax /* rsp */
@@ -220,13 +220,18 @@ sysret_careful:
        jmp sysret_check
 
        /* Handle a signal */ 
-       /* edx: work flags (arg3) */
 sysret_signal:
        sti
+       testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx
+       jz    1f
+
+       /* Really a signal */
+       /* edx: work flags (arg3) */
        leaq do_notify_resume(%rip),%rax
        leaq -ARGOFFSET(%rsp),%rdi # &pt_regs -> arg1
        xorl %esi,%esi # oldset -> arg2
        call ptregscall_common
+1:     movl $_TIF_NEED_RESCHED,%edi
        jmp sysret_check
        
        /* Do syscall tracing */
@@ -418,7 +423,7 @@ ENTRY(stub_rt_sigreturn)
        testl $3,CS(%rdi)
        je 1f
        swapgs  
-1:     addl $1,%gs:pda_irqcount        # RED-PEN should check preempt count
+1:     incl    %gs:pda_irqcount        # RED-PEN should check preempt count
        movq %gs:pda_irqstackptr,%rax
        cmoveq %rax,%rsp                                                        
        pushq %rdi                      # save old stack        
@@ -431,7 +436,7 @@ ENTRY(common_interrupt)
 ret_from_intr:         
        popq  %rdi
        cli     
-       subl $1,%gs:pda_irqcount
+       decl %gs:pda_irqcount
 #ifdef CONFIG_DEBUG_INFO
        movq RBP(%rdi),%rbp
 #endif
@@ -484,16 +489,18 @@ retint_careful:
        jmp retint_check
        
 retint_signal:
+       testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx
+       jz    retint_swapgs
        sti
        SAVE_REST
        movq $-1,ORIG_RAX(%rsp)                         
-       xorq %rsi,%rsi          # oldset
+       xorl %esi,%esi          # oldset
        movq %rsp,%rdi          # &pt_regs
        call do_notify_resume
        RESTORE_REST
        cli
+       movl $_TIF_NEED_RESCHED,%edi
        GET_THREAD_INFO(%rcx)
-       movl $_TIF_WORK_MASK,%edi
        jmp retint_check
 
 #ifdef CONFIG_PREEMPT
@@ -745,7 +752,7 @@ child_rip:
        movq %rsi, %rdi
        call *%rax
        # exit
-       xorq %rdi, %rdi
+       xorl %edi, %edi
        call do_exit
 
 /*
@@ -911,3 +918,15 @@ ENTRY(machine_check)
 ENTRY(call_debug)
        zeroentry do_call_debug
 
+ENTRY(call_softirq)
+       movq %gs:pda_irqstackptr,%rax
+       pushq %r15
+       movq %rsp,%r15
+       incl %gs:pda_irqcount
+       cmove %rax,%rsp
+       call __do_softirq
+       movq %r15,%rsp
+       decl %gs:pda_irqcount
+       popq %r15
+       ret
+