summaryrefslogtreecommitdiffhomepage
path: root/vdso/syscalls.h
diff options
context:
space:
mode:
authorkevin.xu <cming.xu@gmail.com>2020-04-27 21:51:31 +0800
committerGitHub <noreply@github.com>2020-04-27 21:51:31 +0800
commite896ca54db67524afc20b644d43c72185e72dc0e (patch)
tree2a16f3a62a5cafd098f1f028c621f1b655589d69 /vdso/syscalls.h
parent1f19624fa127d7d59cabe29593cc80b7fe6c81f8 (diff)
parent3c67754663f424f2ebbc0ff2a4c80e30618d5355 (diff)
Merge pull request #1 from google/master
catch up
Diffstat (limited to 'vdso/syscalls.h')
-rw-r--r--vdso/syscalls.h33
1 files changed, 17 insertions, 16 deletions
diff --git a/vdso/syscalls.h b/vdso/syscalls.h
index f5865bb72..0c6a922a0 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,22 +54,15 @@ 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");
}
-static inline int sys_clock_gettime(clockid_t _clkid, struct timespec *_ts) {
- register struct timespec *ts asm("x1") = _ts;
+#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;
register long ret asm("x0");
register long nr asm("x8") = __NR_clock_gettime;
@@ -78,8 +74,8 @@ static inline int sys_clock_gettime(clockid_t _clkid, struct timespec *_ts) {
return ret;
}
-static inline int sys_clock_getres(clockid_t _clkid, struct timespec *_ts) {
- register struct timespec *ts asm("x1") = _ts;
+static inline int sys_clock_getres(clockid_t _clkid, struct timespec* _ts) {
+ register struct timespec* ts asm("x1") = _ts;
register clockid_t clkid asm("x0") = _clkid;
register long ret asm("x0");
register long nr asm("x8") = __NR_clock_getres;
@@ -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