diff options
Diffstat (limited to 'vdso')
-rw-r--r-- | vdso/syscalls.h | 25 | ||||
-rw-r--r-- | vdso/vdso.cc | 12 | ||||
-rw-r--r-- | vdso/vdso_amd64.lds | 1 |
3 files changed, 20 insertions, 18 deletions
diff --git a/vdso/syscalls.h b/vdso/syscalls.h index b6d15a7d3..f630ae563 100644 --- a/vdso/syscalls.h +++ b/vdso/syscalls.h @@ -26,6 +26,9 @@ #include <stddef.h> #include <sys/types.h> +#define __stringify_1(x...) #x +#define __stringify(x...) __stringify_1(x) + namespace vdso { #if __x86_64__ @@ -51,20 +54,13 @@ static inline int sys_getcpu(unsigned* cpu, unsigned* node, return num; } -#elif __aarch64__ - -static inline int sys_rt_sigreturn(void) { - int num = __NR_rt_sigreturn; - - asm volatile( - "mov x8, %0\n" - "svc #0 \n" - : "+r"(num) - : - :); - return num; +static inline void sys_rt_sigreturn(void) { + asm volatile("movl $" __stringify(__NR_rt_sigreturn)", %eax \n" + "syscall \n"); } +#elif __aarch64__ + static inline int sys_clock_gettime(clockid_t _clkid, struct timespec* _ts) { register struct timespec* ts asm("x1") = _ts; register clockid_t clkid asm("x0") = _clkid; @@ -91,6 +87,11 @@ static inline int sys_clock_getres(clockid_t _clkid, struct timespec* _ts) { return ret; } +static inline void sys_rt_sigreturn(void) { + asm volatile("mov x8, #" __stringify(__NR_rt_sigreturn)" \n" + "svc #0 \n"); +} + #else #error "unsupported architecture" #endif diff --git a/vdso/vdso.cc b/vdso/vdso.cc index 8bb80a7a4..62f59766d 100644 --- a/vdso/vdso.cc +++ b/vdso/vdso.cc @@ -69,6 +69,12 @@ int __common_gettimeofday(struct timeval* tv, struct timezone* tz) { } } // namespace +// __kernel_rt_sigreturn() implements rt_sigreturn() +extern "C" void __kernel_rt_sigreturn(unsigned long unused) { + // No optimizations yet, just make the real system call. + sys_rt_sigreturn(); +} + #if __x86_64__ // __vdso_clock_gettime() implements clock_gettime() @@ -139,12 +145,6 @@ extern "C" int __kernel_clock_getres(clockid_t clock, struct timespec* res) { return ret; } -// __kernel_rt_sigreturn() implements gettimeofday() -extern "C" int __kernel_rt_sigreturn(unsigned long unused) { - // No optimizations yet, just make the real system call. - return sys_rt_sigreturn(); -} - #else #error "unsupported architecture" #endif diff --git a/vdso/vdso_amd64.lds b/vdso/vdso_amd64.lds index e2615ae9e..d114290da 100644 --- a/vdso/vdso_amd64.lds +++ b/vdso/vdso_amd64.lds @@ -95,6 +95,7 @@ VERSION { __vdso_getcpu; time; __vdso_time; + __kernel_rt_sigreturn; local: *; }; |