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
9 #include <sys/syscall.h>
10 #include <stdarg.h>
11 /* psm: including sys/prctl.h would depend on kernel headers */
12
13 #ifdef __NR_prctl
14 extern int prctl (int __option, ...);
prctl(int __option,...)15 int prctl (int __option, ...)
16 {
17 register long no __asm__("B0");
18 register long a __asm__("A4");
19 register long b __asm__("B4");
20 register long c __asm__("A6");
21 register long d __asm__("B6");
22 register long e __asm__("A8");
23 int __res;
24 va_list ap;
25
26 va_start( ap, __option);
27 a = __option;
28 b = va_arg( ap, long);
29 c = va_arg( ap, long);
30 d = va_arg( ap, long);
31 e = va_arg( ap, long);
32 va_end( ap );
33
34 no = __NR_prctl;
35
36 __asm__ __volatile__ ("SWE" : "=a" (a) : "a" (a), "b" (b), "a" (c), "b" (d), "a" (e), "b" (no)
37 : "memory", "cc");
38
39 __res = a;
40 __SYSCALL_RETURN (int);
41 }
42 #endif
43