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