Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / arch / um / kernel / tt / syscall_kern.c
1 /* 
2  * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
3  * Licensed under the GPL
4  */
5
6 #include "linux/types.h"
7 #include "linux/utime.h"
8 #include "linux/sys.h"
9 #include "linux/ptrace.h"
10 #include "asm/unistd.h"
11 #include "asm/ptrace.h"
12 #include "asm/uaccess.h"
13 #include "asm/stat.h"
14 #include "sysdep/syscalls.h"
15 #include "sysdep/sigcontext.h"
16 #include "kern_util.h"
17 #include "syscall.h"
18
19 void syscall_handler_tt(int sig, struct pt_regs *regs)
20 {
21         void *sc;
22         long result;
23         int syscall;
24 #ifdef CONFIG_SYSCALL_DEBUG
25         int index;
26 #endif
27         sc = UPT_SC(&regs->regs);
28         SC_START_SYSCALL(sc);
29
30         syscall = UPT_SYSCALL_NR(&regs->regs);
31
32 #ifdef CONFIG_SYSCALL_DEBUG
33         index = record_syscall_start(syscall);
34 #endif
35
36         syscall_trace(&regs->regs, 0);
37
38         current->thread.nsyscalls++;
39         nsyscalls++;
40
41         if((syscall >= NR_syscalls) || (syscall < 0))
42                 result = -ENOSYS;
43         else result = EXECUTE_SYSCALL(syscall, regs);
44
45         /* regs->sc may have changed while the system call ran (there may
46          * have been an interrupt or segfault), so it needs to be refreshed.
47          */
48         UPT_SC(&regs->regs) = sc;
49
50         SC_SET_SYSCALL_RETURN(sc, result);
51
52         syscall_trace(&regs->regs, 1);
53 #ifdef CONFIG_SYSCALL_DEBUG
54         record_syscall_end(index, result);
55 #endif
56 }