xref: /openbmc/linux/arch/um/kernel/skas/syscall.c (revision 9b9c2cd4)
1 /*
2  * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3  * Licensed under the GPL
4  */
5 
6 #include <linux/kernel.h>
7 #include <linux/ptrace.h>
8 #include <kern_util.h>
9 #include <sysdep/ptrace.h>
10 #include <sysdep/syscalls.h>
11 #include <os.h>
12 
13 void handle_syscall(struct uml_pt_regs *r)
14 {
15 	struct pt_regs *regs = container_of(r, struct pt_regs, regs);
16 	long result;
17 	int syscall;
18 
19 	if (syscall_trace_enter(regs)) {
20 		result = -ENOSYS;
21 		goto out;
22 	}
23 
24 	syscall = get_syscall(r);
25 
26 	if ((syscall > __NR_syscall_max) || syscall < 0)
27 		result = -ENOSYS;
28 	else
29 		result = EXECUTE_SYSCALL(syscall, regs);
30 
31 out:
32 	PT_REGS_SET_SYSCALL_RETURN(regs, result);
33 
34 	syscall_trace_leave(regs);
35 }
36