ARM: implement get_tls syscall
authorNicolas Pitre <nicolas.pitre@linaro.org>
Fri, 28 Jul 2017 19:35:35 +0000 (15:35 -0400)
committerNicolas Pitre <nicolas.pitre@linaro.org>
Sun, 10 Sep 2017 23:31:46 +0000 (19:31 -0400)
When there is no dedicated register to hold the tp value and no MMU
to provide a fixed address kuser helper entry point, all that is
left as fallback is a syscall.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Acked-by: Mickael GUENE <mickael.guene@st.com>
Tested-by: Vincent Abriou <vincent.abriou@st.com>
Tested-by: Andras Szemzo <szemzo.andras@gmail.com>
arch/arm/include/uapi/asm/unistd.h
arch/arm/kernel/traps.c

index 28bd456..575b25f 100644 (file)
@@ -35,5 +35,6 @@
 #define __ARM_NR_usr26                 (__ARM_NR_BASE+3)
 #define __ARM_NR_usr32                 (__ARM_NR_BASE+4)
 #define __ARM_NR_set_tls               (__ARM_NR_BASE+5)
+#define __ARM_NR_get_tls               (__ARM_NR_BASE+6)
 
 #endif /* _UAPI__ASM_ARM_UNISTD_H */
index 948c648..43c0560 100644 (file)
@@ -647,6 +647,9 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
                set_tls(regs->ARM_r0);
                return 0;
 
+       case NR(get_tls):
+               return current_thread_info()->tp_value[0];
+
        default:
                /* Calls 9f00xx..9f07ff are defined to return -ENOSYS
                   if not implemented, rather than raising SIGILL.  This