syscall.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* syscall for m68k/uClibc
  2. *
  3. * Copyright (C) 2005-2006 by Christian Magnusson <mag@mag.cx>
  4. * Copyright (C) 2005-2006 Erik Andersen <andersen@uclibc.org>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU Library General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or (at your
  9. * option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful, but WITHOUT
  12. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
  14. * for more details.
  15. *
  16. * You should have received a copy of the GNU Library General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #include <features.h>
  21. #include <errno.h>
  22. #include <sys/types.h>
  23. #include <sys/syscall.h>
  24. long syscall(long sysnum, long a, long b, long c, long d, long e, long f);
  25. long syscall(long sysnum, long a, long b, long c, long d, long e, long f)
  26. {
  27. long __res;
  28. __asm__ __volatile__ (
  29. "movel %7, %%a0\n\t"
  30. "movel %6, %%d5\n\t"
  31. "movel %5, %%d4\n\t"
  32. "movel %4, %%d3\n\t"
  33. "movel %3, %%d2\n\t"
  34. "movel %2, %%d1\n\t"
  35. "movel %1, %%d0\n\t"
  36. "trap #0\n\t"
  37. "movel %%d0, %0"
  38. : "=g" (__res)
  39. : "g" (sysnum),
  40. "g" ((long)a), "g" ((long)b), "g" ((long)c),
  41. "g" ((long)d), "g" ((long)e), "g" ((long)f)
  42. : "memory", "cc", "%d0", "%d1", "%d2", "%d3",
  43. "%d4", "%d5", "%a0");
  44. __syscall_return(long,__res);
  45. }