summaryrefslogtreecommitdiffhomepage
path: root/vdso/vdso_time.cc
diff options
context:
space:
mode:
Diffstat (limited to 'vdso/vdso_time.cc')
-rw-r--r--vdso/vdso_time.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/vdso/vdso_time.cc b/vdso/vdso_time.cc
index a59771bff..9fc262f60 100644
--- a/vdso/vdso_time.cc
+++ b/vdso/vdso_time.cc
@@ -55,12 +55,26 @@ struct params {
//
// So instead, we use inline assembly with a construct that seems to have wide
// compatibility across many toolchains.
+#if __x86_64__
+
+inline struct params* get_params() {
+ struct params* p = nullptr;
+ asm("leaq _params(%%rip), %0" : "=r"(p) : :);
+ return p;
+}
+
+#elif __aarch64__
+
inline struct params* get_params() {
struct params* p = nullptr;
- asm volatile("leaq _params(%%rip), %0" : "=r"(p) : :);
+ asm("adr %0, _params" : "=r"(p) : :);
return p;
}
+#else
+#error "unsupported architecture"
+#endif
+
namespace vdso {
const uint64_t kNsecsPerSec = 1000000000UL;