/*1* Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)2* Licensed under the GPL3*/45#include "linux/kernel.h"6#include "linux/ptrace.h"7#include "kern_util.h"8#include "sysdep/ptrace.h"9#include "sysdep/syscalls.h"1011extern int syscall_table_size;12#define NR_SYSCALLS (syscall_table_size / sizeof(void *))1314void handle_syscall(struct uml_pt_regs *r)15{16struct pt_regs *regs = container_of(r, struct pt_regs, regs);17long result;18int syscall;1920syscall_trace(r, 0);2122/*23* This should go in the declaration of syscall, but when I do that,24* strace -f -c bash -c 'ls ; ls' breaks, sometimes not tracing25* children at all, sometimes hanging when bash doesn't see the first26* ls exit.27* The assembly looks functionally the same to me. This is28* gcc version 4.0.1 20050727 (Red Hat 4.0.1-5)29* in case it's a compiler bug.30*/31syscall = UPT_SYSCALL_NR(r);32if ((syscall >= NR_SYSCALLS) || (syscall < 0))33result = -ENOSYS;34else result = EXECUTE_SYSCALL(syscall, regs);3536REGS_SET_SYSCALL_RETURN(r->gp, result);3738syscall_trace(r, 1);39}404142