prctl.c 959 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * prctl() for uClibc
  4. *
  5. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  6. *
  7. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  8. */
  9. #include <sys/syscall.h>
  10. #include <stdarg.h>
  11. /* psm: including sys/prctl.h would depend on kernel headers */
  12. #ifdef __NR_prctl
  13. extern int prctl (int __option, ...);
  14. int prctl (int __option, ...)
  15. {
  16. register long no __asm__("B0");
  17. register long a __asm__("A4");
  18. register long b __asm__("B4");
  19. register long c __asm__("A6");
  20. register long d __asm__("B6");
  21. register long e __asm__("A8");
  22. int __res;
  23. va_list ap;
  24. va_start( ap, __option);
  25. a = __option;
  26. b = va_arg( ap, long);
  27. c = va_arg( ap, long);
  28. d = va_arg( ap, long);
  29. e = va_arg( ap, long);
  30. va_end( ap );
  31. no = __NR_prctl;
  32. __asm__ __volatile__ ("SWE" : "=a" (a) : "a" (a), "b" (b), "a" (c), "b" (d), "a" (e), "b" (no)
  33. : "memory", "cc");
  34. __res = a;
  35. __SYSCALL_RETURN (int);
  36. }
  37. #endif