syscall.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* syscall for frv/uClibc
  2. *
  3. * Copyright (C) 2004 by Alexandre Oliva <aoliva@redhat.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU Library General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or (at your
  8. * option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
  13. * for more details.
  14. *
  15. * You should have received a copy of the GNU Library General Public License
  16. * along with this program; see the file COPYING.LIB. If not, see
  17. * <http://www.gnu.org/licenses/>.
  18. */
  19. #include <features.h>
  20. #include <errno.h>
  21. #include <sys/types.h>
  22. #include <sys/syscall.h>
  23. long syscall(long sysnum, long arg1, long arg2, long arg3,
  24. long arg4, long arg5, long arg6)
  25. {
  26. register unsigned long __scnum __asm__ ("gr7") = (sysnum);
  27. register unsigned long __sc0 __asm__ ("gr8") = (unsigned long) (arg1);
  28. register unsigned long __sc1 __asm__ ("gr9") = (unsigned long) (arg2);
  29. register unsigned long __sc2 __asm__ ("gr10") = (unsigned long) (arg3);
  30. register unsigned long __sc3 __asm__ ("gr11") = (unsigned long) (arg4);
  31. register unsigned long __sc4 __asm__ ("gr12") = (unsigned long) (arg5);
  32. register unsigned long __sc5 __asm__ ("gr13") = (unsigned long) (arg6);
  33. __asm__ __volatile__ ("tra gr0,gr0"
  34. : "+r" (__sc0)
  35. : "r" (__scnum), "r" (__sc1), "r" (__sc2),
  36. "r" (__sc3), "r" (__sc4), "r" (__sc5));
  37. return (long) __sc0;
  38. }