fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / mips / kernel / scall64-64.S
index 19e430d..fc9d4e7 100644 (file)
@@ -7,17 +7,18 @@
  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
  * Copyright (C) 2001 MIPS Technologies, Inc.
  */
-#include <linux/config.h>
 #include <linux/errno.h>
 #include <asm/asm.h>
 #include <asm/asmmacro.h>
+#include <asm/irqflags.h>
 #include <asm/mipsregs.h>
 #include <asm/regdef.h>
 #include <asm/stackframe.h>
-#include <asm/offset.h>
+#include <asm/asm-offsets.h>
 #include <asm/sysmips.h>
 #include <asm/thread_info.h>
 #include <asm/unistd.h>
+#include <asm/war.h>
 
 #ifndef CONFIG_BINFMT_ELF32
 /* Neither O32 nor N32, so define handle_sys here */
@@ -33,12 +34,12 @@ NESTED(handle_sys64, PT_SIZE, sp)
         */
        .set    noat
        SAVE_SOME
+       TRACE_IRQS_ON_RELOAD
        STI
        .set    at
 #endif
 
-FEXPORT(__handle_sys64)
-       subu    t0, v0, __NR_64_Linux   # check syscall number
+       dsubu   t0, v0, __NR_64_Linux   # check syscall number
        sltiu   t0, t0, __NR_64_Linux_syscalls + 1
 #if !defined(CONFIG_MIPS32_O32) && !defined(CONFIG_MIPS32_N32)
        ld      t1, PT_EPC(sp)          # skip syscall on return
@@ -53,8 +54,10 @@ FEXPORT(__handle_sys64)
 
        sd      a3, PT_R26(sp)          # save a3 for syscall restarting
 
-       LONG_L  t0, TI_FLAGS($28)
-       bltz    t0, syscall_trace_entry # syscall tracing enabled?
+       li      t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
+       LONG_L  t0, TI_FLAGS($28)       # syscall tracing enabled?
+       and     t0, t1, t0
+       bnez    t0, syscall_trace_entry
 
        jalr    t2                      # Do The Real Thing (TM)
 
@@ -63,12 +66,12 @@ FEXPORT(__handle_sys64)
        sd      t0, PT_R7(sp)           # set error flag
        beqz    t0, 1f
 
-       negu    v0                      # error
+       dnegu   v0                      # error
        sd      v0, PT_R0(sp)           # set flag for syscall
                                        # restarting
 1:     sd      v0, PT_R2(sp)           # result
 
-syscall_exit:
+n64_syscall_exit:
        local_irq_disable               # make sure need_resched and
                                        # signals dont change between
                                        # sampling and return
@@ -86,24 +89,27 @@ n64_syscall_exit_work:
 
 syscall_trace_entry:
        SAVE_STATIC
-       sd      t2,PT_R1(sp)
+       move    s0, t2
        move    a0, sp
        li      a1, 0
        jal     do_syscall_trace
-       ld      t2,PT_R1(sp)
 
+       move    t0, s0
+       RESTORE_STATIC
        ld      a0, PT_R4(sp)           # Restore argument registers
        ld      a1, PT_R5(sp)
        ld      a2, PT_R6(sp)
        ld      a3, PT_R7(sp)
-       jalr    t2
+       ld      a4, PT_R8(sp)
+       ld      a5, PT_R9(sp)
+       jalr    t0
 
        li      t0, -EMAXERRNO - 1      # error?
        sltu    t0, t0, v0
        sd      t0, PT_R7(sp)           # set error flag
        beqz    t0, 1f
 
-       negu    v0                      # error
+       dnegu   v0                      # error
        sd      v0, PT_R0(sp)           # set flag for syscall restarting
 1:     sd      v0, PT_R2(sp)           # result
 
@@ -111,11 +117,11 @@ syscall_trace_entry:
 
 illegal_syscall:
        /* This also isn't a 64-bit syscall, throw an error.  */
-       li      v0, ENOSYS                      # error
+       li      v0, -ENOSYS                     # error
        sd      v0, PT_R2(sp)
        li      t0, 1                           # set error flag
        sd      t0, PT_R7(sp)
-       j       syscall_exit
+       j       n64_syscall_exit
        END(handle_sys64)
 
        LEAF(mips_atomic_set)
@@ -133,7 +139,11 @@ illegal_syscall:
 1:     ll      v0, (a1)
        move    a0, a2
 2:     sc      a0, (a1)
+#if R10000_LLSC_WAR
+       beqzl   a0, 1b
+#else
        beqz    a0, 1b
+#endif
 
        .section __ex_table,"a"
        PTR     1b, bad_stack
@@ -167,19 +177,7 @@ illegal_syscall:
        sd      zero, PT_R7(sp)         # success
        sd      v0, PT_R2(sp)           # result
 
-       /* Success, so skip usual error handling garbage.  */
-       LONG_L  a2, TI_FLAGS($28)       # syscall tracing enabled?
-       li      t0, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
-       and     t0, a2, t0
-       bnez    t0, 1f
-
-       b       syscall_exit
-
-1:     SAVE_STATIC
-       move    a0, sp
-       li      a1, 1
-       jal     do_syscall_trace
-       j       syscall_exit
+       j       n64_syscall_exit        # continue like a normal syscall
 
 no_mem:        li      v0, -ENOMEM
        jr      ra
@@ -198,17 +196,6 @@ bad_alignment:
        j       _sys_sysmips
        END(sys_sysmips)
 
-       LEAF(sys_syscall)                       /* Quick'n'dirty ... */
-       move    v0, a0
-       move    a0, a1
-       move    a1, a2
-       move    a2, a3
-       move    a3, a4
-       move    a4, a5
-       move    a5, a6
-       j       __handle_sys64
-       END(sys_syscall)
-
        .align  3
 sys_call_table:
        PTR     sys_read                        /* 5000 */
@@ -438,7 +425,7 @@ sys_call_table:
        PTR     sys_clock_nanosleep
        PTR     sys_tgkill                      /* 5225 */
        PTR     sys_utimes
-       PTR     sys_ni_syscall                  /* sys_mbind */
+       PTR     sys_mbind
        PTR     sys_ni_syscall                  /* sys_get_mempolicy */
        PTR     sys_ni_syscall                  /* sys_set_mempolicy */
        PTR     sys_mq_open                     /* 5230 */
@@ -447,3 +434,40 @@ sys_call_table:
        PTR     sys_mq_timedreceive
        PTR     sys_mq_notify
        PTR     sys_mq_getsetattr               /* 5235 */
+       PTR     sys_vserver
+       PTR     sys_waitid
+       PTR     sys_ni_syscall                  /* available, was setaltroot */
+       PTR     sys_add_key
+       PTR     sys_request_key                 /* 5240 */
+       PTR     sys_keyctl
+       PTR     sys_set_thread_area
+       PTR     sys_inotify_init
+       PTR     sys_inotify_add_watch
+       PTR     sys_inotify_rm_watch            /* 5245 */
+       PTR     sys_migrate_pages
+       PTR     sys_openat
+       PTR     sys_mkdirat
+       PTR     sys_mknodat
+       PTR     sys_fchownat                    /* 5250 */
+       PTR     sys_futimesat
+       PTR     sys_newfstatat
+       PTR     sys_unlinkat
+       PTR     sys_renameat
+       PTR     sys_linkat                      /* 5255 */
+       PTR     sys_symlinkat
+       PTR     sys_readlinkat
+       PTR     sys_fchmodat
+       PTR     sys_faccessat
+       PTR     sys_pselect6                    /* 5260 */
+       PTR     sys_ppoll
+       PTR     sys_unshare
+       PTR     sys_splice
+       PTR     sys_sync_file_range
+       PTR     sys_tee                         /* 5265 */
+       PTR     sys_vmsplice
+       PTR     sys_move_pages
+       PTR     sys_set_robust_list
+       PTR     sys_get_robust_list
+       PTR     sys_kexec_load                  /* 5270 */
+       PTR     sys_getcpu
+       PTR     sys_epoll_pwait