syscall.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* vi: set sw=4 ts=4: */
  2. /* syscall for blackfin/uClibc
  3. *
  4. * Copyright (C) 2004-2006 by Analog Devices Inc.
  5. * Copyright (C) 2002 by Erik Andersen <andersen@uclibc.org>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Library General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or (at your
  10. * option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
  15. * for more details.
  16. *
  17. * You should have received a copy of the GNU Library General Public License
  18. * along with this program; if not, write to the Free Software Foundation,
  19. * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. #include <features.h>
  22. #include <errno.h>
  23. #include <sys/types.h>
  24. #include <sys/syscall.h>
  25. long syscall(long sysnum, long a, long b, long c, long d, long e, long f)
  26. {
  27. int _r0 = 0;
  28. __asm__ __volatile__ (
  29. "excpt 0;"
  30. : "=q0" (_r0)
  31. : "qA" (sysnum),
  32. "q0" (a),
  33. "q1" (b),
  34. "q2" (c),
  35. "q3" (d),
  36. "q4" (e),
  37. "q5" (f)
  38. : "memory", "CC");
  39. if (_r0 >= (unsigned long) -4095) {
  40. (*__errno_location()) = (-_r0);
  41. _r0 = (unsigned long) -1;
  42. }
  43. return (long)_r0;
  44. }