summaryrefslogtreecommitdiff
path: root/arch/mips
diff options
context:
space:
mode:
authorTom Zanussi <zanussi@kernel.org>2020-01-14 13:50:16 -0600
committerTom Zanussi <zanussi@kernel.org>2020-01-14 13:50:16 -0600
commit2c99072340e97e3887fe81aa2628095524448ece (patch)
tree24b39d2824607770fd43140dfc142a1713e1bf93 /arch/mips
parent3bad60f64b7c60c842a38af913fc1dcaac2ab876 (diff)
parentb0cdffaa546e24acf92ab3b0d4e917a51aff6a82 (diff)
downloadlinux-rt-2c99072340e97e3887fe81aa2628095524448ece.tar.gz
Merge tag 'v4.14.163' into v4.14-rt-work
This is the 4.14.163 stable release
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/include/asm/thread_info.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
index 5e8927f99a76..a0338dbabeaa 100644
--- a/arch/mips/include/asm/thread_info.h
+++ b/arch/mips/include/asm/thread_info.h
@@ -52,8 +52,26 @@ struct thread_info {
#define init_thread_info (init_thread_union.thread_info)
#define init_stack (init_thread_union.stack)
-/* How to get the thread information struct from C. */
+/*
+ * A pointer to the struct thread_info for the currently executing thread is
+ * held in register $28/$gp.
+ *
+ * We declare __current_thread_info as a global register variable rather than a
+ * local register variable within current_thread_info() because clang doesn't
+ * support explicit local register variables.
+ *
+ * When building the VDSO we take care not to declare the global register
+ * variable because this causes GCC to not preserve the value of $28/$gp in
+ * functions that change its value (which is common in the PIC VDSO when
+ * accessing the GOT). Since the VDSO shouldn't be accessing
+ * __current_thread_info anyway we declare it extern in order to cause a link
+ * failure if it's referenced.
+ */
+#ifdef __VDSO__
+extern struct thread_info *__current_thread_info;
+#else
register struct thread_info *__current_thread_info __asm__("$28");
+#endif
static inline struct thread_info *current_thread_info(void)
{