syscall.c 689 B

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