2005-09-04 06:57:42 +08:00
|
|
|
/*
|
2007-10-16 16:27:00 +08:00
|
|
|
* Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
|
2005-09-04 06:57:42 +08:00
|
|
|
* Licensed under the GPL
|
|
|
|
*/
|
|
|
|
|
2012-10-08 10:27:32 +08:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/ptrace.h>
|
|
|
|
#include <kern_util.h>
|
|
|
|
#include <sysdep/ptrace.h>
|
|
|
|
#include <sysdep/syscalls.h>
|
2015-10-26 02:54:33 +08:00
|
|
|
#include <os.h>
|
2005-09-04 06:57:42 +08:00
|
|
|
|
2007-10-16 16:26:58 +08:00
|
|
|
void handle_syscall(struct uml_pt_regs *r)
|
2005-09-04 06:57:42 +08:00
|
|
|
{
|
|
|
|
struct pt_regs *regs = container_of(r, struct pt_regs, regs);
|
|
|
|
long result;
|
|
|
|
int syscall;
|
|
|
|
|
2015-06-01 04:59:03 +08:00
|
|
|
if (syscall_trace_enter(regs)) {
|
|
|
|
result = -ENOSYS;
|
|
|
|
goto out;
|
|
|
|
}
|
2005-09-04 06:57:42 +08:00
|
|
|
|
2015-10-26 02:54:33 +08:00
|
|
|
syscall = get_syscall(r);
|
|
|
|
|
2015-10-26 03:28:14 +08:00
|
|
|
if ((syscall > __NR_syscall_max) || syscall < 0)
|
2005-09-04 06:57:42 +08:00
|
|
|
result = -ENOSYS;
|
2015-10-26 03:28:14 +08:00
|
|
|
else
|
|
|
|
result = EXECUTE_SYSCALL(syscall, regs);
|
2005-09-04 06:57:42 +08:00
|
|
|
|
2015-06-01 04:59:03 +08:00
|
|
|
out:
|
2012-05-23 09:16:35 +08:00
|
|
|
PT_REGS_SET_SYSCALL_RETURN(regs, result);
|
2005-09-04 06:57:42 +08:00
|
|
|
|
2012-05-23 12:18:33 +08:00
|
|
|
syscall_trace_leave(regs);
|
2005-09-04 06:57:42 +08:00
|
|
|
}
|