[PATCH] uml: system call path cleanup
[linux-2.6/btrfs-unstable.git] / arch / um / kernel / tt / syscall_kern.c
blob3d29c90514cc0e10093b15c40188281e9fe92e7b
1 /*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
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"
19 void syscall_handler_tt(int sig, struct pt_regs *regs)
21 void *sc;
22 long result;
23 int syscall;
24 #ifdef CONFIG_SYSCALL_DEBUG
25 int index;
26 index = record_syscall_start(syscall);
27 #endif
28 sc = UPT_SC(&regs->regs);
29 SC_START_SYSCALL(sc);
31 syscall_trace(&regs->regs, 0);
33 current->thread.nsyscalls++;
34 nsyscalls++;
35 syscall = UPT_SYSCALL_NR(&regs->regs);
37 if((syscall >= NR_syscalls) || (syscall < 0))
38 result = -ENOSYS;
39 else result = EXECUTE_SYSCALL(syscall, regs);
41 /* regs->sc may have changed while the system call ran (there may
42 * have been an interrupt or segfault), so it needs to be refreshed.
44 UPT_SC(&regs->regs) = sc;
46 SC_SET_SYSCALL_RETURN(sc, result);
48 syscall_trace(&regs->regs, 1);
49 #ifdef CONFIG_SYSCALL_DEBUG
50 record_syscall_end(index, result);
51 #endif