syscall.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * syscall.c
  3. *
  4. * Port on Texas Instruments TMS320C6x architecture
  5. *
  6. * Copyright (C) 2006, 2010 Texas Instruments Incorporated
  7. * Author: Thomas Charleux (thomas.charleux@jaluna.com)
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <features.h>
  14. #include <errno.h>
  15. #include <sys/types.h>
  16. #include <sys/syscall.h>
  17. #include <unistd.h>
  18. #include <stdarg.h>
  19. long int syscall (long int __sysno, ...)
  20. {
  21. register long no __asm__("B0");
  22. register long a __asm__("A4");
  23. register long b __asm__("B4");
  24. register long c __asm__("A6");
  25. register long d __asm__("B6");
  26. register long e __asm__("A8");
  27. register long f __asm__("B8");
  28. long __res;
  29. va_list ap;
  30. va_start( ap, __sysno);
  31. a = va_arg( ap, long);
  32. b = va_arg( ap, long);
  33. c = va_arg( ap, long);
  34. d = va_arg( ap, long);
  35. e = va_arg( ap, long);
  36. f = va_arg( ap, long);
  37. va_end( ap );
  38. no = __sysno;
  39. __asm__ __volatile__ ("SWE" : "=a" (a) : "a" (a), "b" (b), "a" (c), "b" (d), "a" (e), "b" (f), "b" (no)
  40. : "memory", "cc");
  41. __res = a;
  42. __SYSCALL_RETURN (long);
  43. }