diff options
author | Haibo Xu <haibo.xu@arm.com> | 2019-04-18 16:20:45 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-04-18 16:22:08 -0700 |
commit | f4d434c18002c96511decf8ff1ebdbede46ca6a1 (patch) | |
tree | cc781d877ef0ea64ce33c46d6a30b76eefa4753a /vdso/vdso_time.cc | |
parent | c931c8e0829914718a729e20d7db0c2bf4e73f0b (diff) |
Enable vDSO support on arm64.
Signed-off-by: Haibo Xu <haibo.xu@arm.com>
Change-Id: I20103cd6d193431ab7e8120005da1f567b9bc2eb
PiperOrigin-RevId: 244280119
Diffstat (limited to 'vdso/vdso_time.cc')
-rw-r--r-- | vdso/vdso_time.cc | 16 |
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; |