syscall.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* syscall for m68k/uClibc
  2. *
  3. * Copyright (C) 2005 by Christian Magnusson <mag@mag.cx>
  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; if not, write to the Free Software Foundation,
  17. * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  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 a, long b, long c, long d, long e, long f)
  24. {
  25. long __res;
  26. __asm__ __volatile__ ("movel %7, %%a0\n\t"\
  27. "movel %6, %%d5\n\t"\
  28. "movel %5, %%d4\n\t"\
  29. "movel %4, %%d3\n\t"\
  30. "movel %3, %%d2\n\t"\
  31. "movel %2, %%d1\n\t"\
  32. "movel %1, %%d0\n\t"\
  33. "trap #0\n\t"\
  34. "movel %%d0, %0"\
  35. : "=g" (__res)\
  36. : "g" (sysnum),\
  37. "a" ((long)a),\
  38. "a" ((long)b),\
  39. "a" ((long)c),\
  40. "a" ((long)d),\
  41. "a" ((long)e),\
  42. "g" ((long)f)\
  43. : "cc", "%d0", "%d1", "%d2", "%d3",\
  44. "%d4", "%d5", "%a0");
  45. __syscall_return(long,__res);
  46. }