]> err.no Git - linux-2.6/blobdiff - arch/sparc64/kernel/rtrap.S
Merge git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm
[linux-2.6] / arch / sparc64 / kernel / rtrap.S
index 3522cd66f3bb36e0e1250b4ac7cd9dadebcfb52d..ecf6753b204a07d2da8b5a9c1bad0bbc35995218 100644 (file)
 #define                RTRAP_PSTATE_IRQOFF     (PSTATE_RMO|PSTATE_PEF|PSTATE_PRIV)
 #define                RTRAP_PSTATE_AG_IRQOFF  (PSTATE_RMO|PSTATE_PEF|PSTATE_PRIV|PSTATE_AG)
 
-               /* Register %l6 keeps track of whether we are returning
-                * from a system call or not.  It is cleared if we call
-                * do_notify_resume, and it must not be otherwise modified
-                * until we fully commit to returning to userspace.
-                */
-
                .text
                .align                  32
 __handle_softirq:
@@ -56,14 +50,12 @@ __handle_user_windows:
                be,pt                   %xcc, __handle_user_windows_continue
                 nop
                mov                     %l5, %o1
-               mov                     %l6, %o2
                add                     %sp, PTREGS_OFF, %o0
-               mov                     %l0, %o3
+               mov                     %l0, %o2
 
                call                    do_notify_resume
                 wrpr                   %g0, RTRAP_PSTATE, %pstate
                wrpr                    %g0, RTRAP_PSTATE_IRQOFF, %pstate
-               clr                     %l6
                /* Signal delivery can modify pt_regs tstate, so we must
                 * reload it.
                 */
@@ -99,14 +91,12 @@ __handle_perfctrs:
                be,pt                   %xcc, __handle_perfctrs_continue
                 sethi                  %hi(TSTATE_PEF), %o0
                mov                     %l5, %o1
-               mov                     %l6, %o2
                add                     %sp, PTREGS_OFF, %o0
-               mov                     %l0, %o3
+               mov                     %l0, %o2
                call                    do_notify_resume
 
                 wrpr                   %g0, RTRAP_PSTATE, %pstate
                wrpr                    %g0, RTRAP_PSTATE_IRQOFF, %pstate
-               clr                     %l6
                /* Signal delivery can modify pt_regs tstate, so we must
                 * reload it.
                 */
@@ -127,13 +117,11 @@ __handle_userfpu:
 
 __handle_signal:
                mov                     %l5, %o1
-               mov                     %l6, %o2
                add                     %sp, PTREGS_OFF, %o0
-               mov                     %l0, %o3
+               mov                     %l0, %o2
                call                    do_notify_resume
                 wrpr                   %g0, RTRAP_PSTATE, %pstate
                wrpr                    %g0, RTRAP_PSTATE_IRQOFF, %pstate
-               clr                     %l6
 
                /* Signal delivery can modify pt_regs tstate, so we must
                 * reload it.
@@ -145,9 +133,8 @@ __handle_signal:
                 andn                   %l1, %l4, %l1
 
                .align                  64
-               .globl                  rtrap_irq, rtrap_clr_l6, rtrap, irqsz_patchme, rtrap_xcall
+               .globl                  rtrap_irq, rtrap, irqsz_patchme, rtrap_xcall
 rtrap_irq:
-rtrap_clr_l6:  clr                     %l6
 rtrap:
 #ifndef CONFIG_SMP
                sethi                   %hi(per_cpu____cpu_data), %l0
@@ -165,14 +152,26 @@ rtrap:
 __handle_softirq_continue:
 rtrap_xcall:
                sethi                   %hi(0xf << 20), %l4
-               andcc                   %l1, TSTATE_PRIV, %l3
                and                     %l1, %l4, %l4
+               andn                    %l1, %l4, %l1
+               srl                     %l4, 20, %l4
+#ifdef CONFIG_TRACE_IRQFLAGS
+               brnz,pn                 %l4, rtrap_no_irq_enable
+                nop
+               call                    trace_hardirqs_on
+                nop
+               wrpr                    %l4, %pil
+rtrap_no_irq_enable:
+#endif
+               andcc                   %l1, TSTATE_PRIV, %l3
                bne,pn                  %icc, to_kernel
-                andn                   %l1, %l4, %l1
+                nop
 
                /* We must hold IRQs off and atomically test schedule+signal
                 * state, then hold them off all the way back to userspace.
-                * If we are returning to kernel, none of this matters.
+                * If we are returning to kernel, none of this matters.  Note
+                * that we are disabling interrupts via PSTATE_IE, not using
+                * %pil.
                 *
                 * If we do not do this, there is a window where we would do
                 * the tests, later the signal/resched event arrives but we do
@@ -256,7 +255,6 @@ rt_continue:        ldx                     [%sp + PTREGS_OFF + PT_V9_G1], %g1
 
                ld                      [%sp + PTREGS_OFF + PT_V9_Y], %o3
                wr                      %o3, %g0, %y
-               srl                     %l4, 20, %l4
                wrpr                    %l4, 0x0, %pil
                wrpr                    %g0, 0x1, %tl
                wrpr                    %l1, %g0, %tstate
@@ -374,8 +372,8 @@ to_kernel:
                 ldx                    [%g6 + TI_FLAGS], %l5
                andcc                   %l5, _TIF_NEED_RESCHED, %g0
                be,pt                   %xcc, kern_fpucheck
-                srl                    %l4, 20, %l5
-               cmp                     %l5, 0
+                nop
+               cmp                     %l4, 0
                bne,pn                  %xcc, kern_fpucheck
                 sethi                  %hi(PREEMPT_ACTIVE), %l6
                stw                     %l6, [%g6 + TI_PRE_COUNT]