powerpc: Fix sysfs pci mmap on 32-bit machines with 64-bit PCI
[safe/jmp/linux-2.6] / arch / sh / kernel / entry-common.S
index ab4ebb8..efbb426 100644 (file)
@@ -1,9 +1,6 @@
-/* $Id: entry.S,v 1.37 2004/06/11 13:02:46 doyu Exp $
- *
- *  linux/arch/sh/entry.S
- *
+/* 
  *  Copyright (C) 1999, 2000, 2002  Niibe Yutaka
- *  Copyright (C) 2003  Paul Mundt
+ *  Copyright (C) 2003 - 2008  Paul Mundt
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -95,6 +92,7 @@ ENTRY(ret_from_irq)
        bra     resume_userspace
         nop
 ENTRY(resume_kernel)
+       cli
        mov.l   @(TI_PRE_COUNT,r8), r0  ! current_thread_info->preempt_count
        tst     r0, r0
        bf      noresched
@@ -108,28 +106,9 @@ need_resched:
        and     #0xf0, r0               ! interrupts off (exception path)?
        cmp/eq  #0xf0, r0
        bt      noresched
-
-       mov.l   1f, r0
-       mov.l   r0, @(TI_PRE_COUNT,r8)
-
-#ifdef CONFIG_TRACE_IRQFLAGS
        mov.l   3f, r0
-       jsr     @r0
+       jsr     @r0                     ! call preempt_schedule_irq
         nop
-#endif
-       sti
-       mov.l   2f, r0
-       jsr     @r0
-        nop
-       mov     #0, r0
-       mov.l   r0, @(TI_PRE_COUNT,r8)
-       cli
-#ifdef CONFIG_TRACE_IRQFLAGS
-       mov.l   4f, r0
-       jsr     @r0
-        nop
-#endif
-
        bra     need_resched
         nop
 
@@ -140,10 +119,7 @@ noresched:
        .align 2
 1:     .long   PREEMPT_ACTIVE
 2:     .long   schedule
-#ifdef CONFIG_TRACE_IRQFLAGS
-3:     .long   trace_hardirqs_on
-4:     .long   trace_hardirqs_off
-#endif
+3:     .long   preempt_schedule_irq
 #endif
 
 ENTRY(resume_userspace)
@@ -176,25 +152,6 @@ work_notifysig:
        jmp     @r1
         lds    r0, pr
 work_resched:
-#ifndef CONFIG_PREEMPT
-       ! gUSA handling
-       mov.l   @(OFF_SP,r15), r0       ! get user space stack pointer
-       mov     r0, r1
-       shll    r0
-       bf/s    1f
-        shll   r0
-       bf/s    1f
-        mov    #OFF_PC, r0
-       !                                 SP >= 0xc0000000 : gUSA mark
-       mov.l   @(r0,r15), r2           ! get user space PC (program counter)
-       mov.l   @(OFF_R0,r15), r3       ! end point
-       cmp/hs  r3, r2                  ! r2 >= r3? 
-       bt      1f
-       add     r3, r1                  ! rewind point #2
-       mov.l   r1, @(r0,r15)           ! reset PC to rewind point #2
-       !
-1:
-#endif
        mov.l   1f, r1
        jsr     @r1                             ! schedule
         nop
@@ -214,7 +171,7 @@ work_resched:
        .align  2
 1:     .long   schedule
 2:     .long   do_notify_resume
-3:     .long   restore_all
+3:     .long   resume_userspace
 #ifdef CONFIG_TRACE_IRQFLAGS
 4:     .long   trace_hardirqs_on
 5:     .long   trace_hardirqs_off
@@ -224,7 +181,7 @@ work_resched:
 syscall_exit_work:
        ! r0: current_thread_info->flags
        ! r8: current_thread_info
-       tst     #_TIF_SYSCALL_TRACE, r0
+       tst     #_TIF_WORK_SYSCALL_MASK, r0
        bt/s    work_pending
         tst    #_TIF_NEED_RESCHED, r0
 #ifdef CONFIG_TRACE_IRQFLAGS
@@ -233,8 +190,8 @@ syscall_exit_work:
         nop
 #endif
        sti
-       ! XXX setup arguments...
-       mov.l   4f, r0                  ! do_syscall_trace
+       mov     r15, r4
+       mov.l   8f, r0                  ! do_syscall_trace_leave
        jsr     @r0
         nop
        bra     resume_userspace
@@ -243,10 +200,11 @@ syscall_exit_work:
        .align  2
 syscall_trace_entry:
        !                       Yes it is traced.
-       ! XXX setup arguments...
-       mov.l   4f, r11         ! Call do_syscall_trace which notifies
+       mov     r15, r4
+       mov.l   7f, r11         ! Call do_syscall_trace_enter which notifies
        jsr     @r11            ! superior (will chomp R[0-7])
         nop
+       mov.l   r0, @(OFF_R0,r15)       ! Save return value
        !                       Reload R0-R4 from kernel stack, where the
        !                       parent may have modified them using
        !                       ptrace(POKEUSR).  (Note that R0-R2 are
@@ -277,6 +235,7 @@ __restore_all:
 
        .align  2
 syscall_badsys:                        ! Bad syscall number
+       get_current_thread_info r8, r0
        mov     #-ENOSYS, r0
        bra     resume_userspace
         mov.l  r0, @(OFF_R0,r15)       ! Return value
@@ -296,7 +255,9 @@ debug_trap:
        mov.l   1f, r8
        add     r0, r8
        mov.l   @r8, r8
-       jmp     @r8
+       jsr     @r8
+        nop
+       bra     __restore_all
         nop
 
        .align  2
@@ -366,7 +327,7 @@ ENTRY(system_call)
        !
        get_current_thread_info r8, r10
        mov.l   @(TI_FLAGS,r8), r8
-       mov     #_TIF_SYSCALL_TRACE, r10
+       mov     #_TIF_WORK_SYSCALL_MASK, r10
        tst     r10, r8
        bf      syscall_trace_entry
        !
@@ -404,8 +365,9 @@ syscall_exit:
 #endif
 2:     .long   NR_syscalls
 3:     .long   sys_call_table
-4:     .long   do_syscall_trace
 #ifdef CONFIG_TRACE_IRQFLAGS
 5:     .long   trace_hardirqs_on
 6:     .long   trace_hardirqs_off
 #endif
+7:     .long   do_syscall_trace_enter
+8:     .long   do_syscall_trace_leave