Merge branch 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-block.git] / arch / blackfin / mach-common / entry.S
index 0df5b834d34eee62b9966afe6527218d5a061e3f..a5847f5d67c7325ae6c53996f02f0b7d348267c3 100644 (file)
@@ -482,6 +482,8 @@ ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/
        [--sp] = ASTAT;
        [--sp] = (R7:6,P5:4);
 
+       ANOMALY_283_315_WORKAROUND(p5, r7)
+
 #ifdef CONFIG_EXACT_HWERR
        /* Make sure all pending read/writes complete. This will ensure any
         * accesses which could cause hardware errors completes, and signal
@@ -492,8 +494,6 @@ ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/
        ssync;
 #endif
 
-       ANOMALY_283_315_WORKAROUND(p5, r7)
-
 #ifdef CONFIG_DEBUG_DOUBLEFAULT
        /*
         * Save these registers, as they are only valid in exception context
@@ -626,13 +626,6 @@ ENTRY(_system_call)
        p0 = [sp + PT_ORIG_P0];
 #endif /* CONFIG_IPIPE */
 
-       /* Check the System Call */
-       r7 = __NR_syscall;
-       /* System call number is passed in P0 */
-       r6 = p0;
-       cc = r6 < r7;
-       if ! cc jump .Lbadsys;
-
        /* are we tracing syscalls?*/
        r7 = sp;
        r6.l = lo(ALIGN_PAGE_MASK);
@@ -642,6 +635,14 @@ ENTRY(_system_call)
        r7 = [p2+TI_FLAGS];
        CC = BITTST(r7,TIF_SYSCALL_TRACE);
        if CC JUMP _sys_trace;
+       CC = BITTST(r7,TIF_SINGLESTEP);
+       if CC JUMP _sys_trace;
+
+       /* Make sure the system call # is valid */
+       p4 = __NR_syscall;
+       /* System call number is passed in P0 */
+       cc = p4 <= p0;
+       if cc jump .Lbadsys;
 
        /* Execute the appropriate system call */
 
@@ -739,9 +740,14 @@ _sys_trace:
        r0 = sp;
        pseudo_long_call _syscall_trace_enter, p5;
 
-       /* Execute the appropriate system call */
-
+       /* Make sure the system call # is valid */
        p4 = [SP + PT_P0];
+       p3 = __NR_syscall;
+       cc = p3 <= p4;
+       r0 = -ENOSYS;
+       if cc jump .Lsys_trace_badsys;
+
+       /* Execute the appropriate system call */
        p5.l = _sys_call_table;
        p5.h = _sys_call_table;
        p5 = p5 + (p4 << 2);
@@ -759,6 +765,7 @@ _sys_trace:
        SP += -12;
        call (p5);
        SP += 24;
+.Lsys_trace_badsys:
        [sp + PT_R0] = r0;
 
        r0 = sp;