From fc009dd8a7afb99c020c863ad3bc198e70117eb3 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 7 Oct 2022 21:31:36 +0000 Subject: [PATCH] riscv64 __get_tls(). Signed-off-by: Mao Han Signed-off-by: Xia Lifang Signed-off-by: Chen Guoyin Signed-off-by: Wang Chen Signed-off-by: Lu Xufan Test: treehugger Change-Id: Ie7616cef6d394ba457c30c58d15f696c9b6d3853 --- libc/platform/bionic/tls.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libc/platform/bionic/tls.h b/libc/platform/bionic/tls.h index bf9e65b5e..e01eccd74 100644 --- a/libc/platform/bionic/tls.h +++ b/libc/platform/bionic/tls.h @@ -34,6 +34,8 @@ # define __get_tls() ({ void** __val; __asm__("mrc p15, 0, %0, c13, c0, 3" : "=r"(__val)); __val; }) #elif defined(__i386__) # define __get_tls() ({ void** __val; __asm__("movl %%gs:0, %0" : "=r"(__val)); __val; }) +#elif defined(__riscv) +# define __get_tls() ({ void** __val; __asm__("mv %0, tp" : "=r"(__val)); __val; }) #elif defined(__x86_64__) # define __get_tls() ({ void** __val; __asm__("mov %%fs:0, %0" : "=r"(__val)); __val; }) #else