prctl.c 934 B

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