]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/arm/kernel/entry-common.S
ARM: 7475/1: sys_trace: allow all syscall arguments to be updated via ptrace
[karo-tx-linux.git] / arch / arm / kernel / entry-common.S
index 4afed88d250a6f6127a8a42a7a3462394b078bfc..978eac57e04a783f8901a16986f6d88f96f125ba 100644 (file)
@@ -51,23 +51,15 @@ ret_fast_syscall:
 fast_work_pending:
        str     r0, [sp, #S_R0+S_OFF]!          @ returned r0
 work_pending:
-       tst     r1, #_TIF_NEED_RESCHED
-       bne     work_resched
-       /*
-        * TIF_SIGPENDING or TIF_NOTIFY_RESUME must've been set if we got here
-        */
-       ldr     r2, [sp, #S_PSR]
        mov     r0, sp                          @ 'regs'
-       tst     r2, #15                         @ are we returning to user mode?
-       bne     no_work_pending                 @ no?  just leave, then...
        mov     r2, why                         @ 'syscall'
-       tst     r1, #_TIF_SIGPENDING            @ delivering a signal?
-       movne   why, #0                         @ prevent further restarts
-       bl      do_notify_resume
-       b       ret_slow_syscall                @ Check work again
+       bl      do_work_pending
+       cmp     r0, #0
+       beq     no_work_pending
+       movlt   scno, #(__NR_restart_syscall - __NR_SYSCALL_BASE)
+       ldmia   sp, {r0 - r6}                   @ have to reload r0 - r6
+       b       local_restart                   @ ... and off we go
 
-work_resched:
-       bl      schedule
 /*
  * "slow" syscall return path.  "why" tells us if this was a real syscall.
  */
@@ -95,13 +87,7 @@ ENDPROC(ret_to_user)
 ENTRY(ret_from_fork)
        bl      schedule_tail
        get_thread_info tsk
-       ldr     r1, [tsk, #TI_FLAGS]            @ check for syscall tracing
        mov     why, #1
-       tst     r1, #_TIF_SYSCALL_WORK          @ are we tracing syscalls?
-       beq     ret_slow_syscall
-       mov     r1, sp
-       mov     r0, #1                          @ trace exit [IP = 1]
-       bl      syscall_trace
        b       ret_slow_syscall
 ENDPROC(ret_from_fork)
 
@@ -415,6 +401,7 @@ ENTRY(vector_swi)
        eor     scno, scno, #__NR_SYSCALL_BASE  @ check OS number
 #endif
 
+local_restart:
        ldr     r10, [tsk, #TI_FLAGS]           @ check for syscall tracing
        stmdb   sp!, {r4, r5}                   @ push fifth and sixth args
 
@@ -448,25 +435,24 @@ ENDPROC(vector_swi)
         * context switches, and waiting for our parent to respond.
         */
 __sys_trace:
-       mov     r2, scno
-       add     r1, sp, #S_OFF
-       mov     r0, #0                          @ trace entry [IP = 0]
-       bl      syscall_trace
+       mov     r1, scno
+       add     r0, sp, #S_OFF
+       bl      syscall_trace_enter
 
        adr     lr, BSYM(__sys_trace_return)    @ return address
        mov     scno, r0                        @ syscall number (possibly new)
        add     r1, sp, #S_R0 + S_OFF           @ pointer to regs
        cmp     scno, #NR_syscalls              @ check upper syscall limit
-       ldmccia r1, {r0 - r3}                   @ have to reload r0 - r3
+       ldmccia r1, {r0 - r6}                   @ have to reload r0 - r6
+       stmccia sp, {r4, r5}                    @ and update the stack args
        ldrcc   pc, [tbl, scno, lsl #2]         @ call sys_* routine
        b       2b
 
 __sys_trace_return:
        str     r0, [sp, #S_R0 + S_OFF]!        @ save returned r0
-       mov     r2, scno
-       mov     r1, sp
-       mov     r0, #1                          @ trace exit [IP = 1]
-       bl      syscall_trace
+       mov     r1, scno
+       mov     r0, sp
+       bl      syscall_trace_exit
        b       ret_slow_syscall
 
        .align  5