All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: Changed current_thread_info() to an equivalent supported by both clang and GCC
@ 2015-01-09 12:06 ` Daniel Sanders
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Sanders @ 2015-01-09 12:06 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle
  Cc: Daniel Sanders, Paul Burton, Markos Chandras, James Hogan, Behan Webster

Without this, a 'break' instruction is executed very early in the boot and
the boot hangs.

The problem is that clang doesn't honour named registers on local variables
and silently treats them as normal uninitialized variables. However, it
does honour them on global variables.

Signed-off-by: Daniel Sanders <daniel.sanders@imgtec.com>
---
 arch/mips/include/asm/thread_info.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

For reference, a similar patch for ARM's stack pointer has already been merged:
  0abc08b ARM: 8170/1: Add global named register current_stack_pointer for ARM

This is part of a patch series to get Linux for Mips working when compiled with
clang. I've chosen to submit this patch individually since it's my first kernel
patch and I'd like to be sure I'm following your processes correctly before I
submit all of them.

Please CC me on replies since I'm not subscribed to the mailing list.

diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
index 99eea59..2a2f3c4 100644
--- a/arch/mips/include/asm/thread_info.h
+++ b/arch/mips/include/asm/thread_info.h
@@ -58,11 +58,11 @@ struct thread_info {
 #define init_stack		(init_thread_union.stack)
 
 /* How to get the thread information struct from C.  */
+register struct thread_info *current_gp_register asm("$28");
+
 static inline struct thread_info *current_thread_info(void)
 {
-	register struct thread_info *__current_thread_info __asm__("$28");
-
-	return __current_thread_info;
+	return current_gp_register;
 }
 
 #endif /* !__ASSEMBLY__ */
-- 
2.1.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-01-17 16:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-09 12:06 [PATCH] MIPS: Changed current_thread_info() to an equivalent supported by both clang and GCC Daniel Sanders
2015-01-09 12:06 ` Daniel Sanders
2015-01-09 12:17 ` Sergei Shtylyov
2015-01-09 13:23   ` Daniel Sanders
2015-01-09 17:26     ` David Daney
2015-01-09 20:06       ` Daniel Sanders
2015-01-09 23:29         ` Behan Webster
2015-01-09 23:52         ` David Daney
2015-01-10 12:53           ` Daniel Sanders
2015-01-16 14:37             ` Ralf Baechle
2015-01-16 15:05               ` Måns Rullgård
2015-01-16 15:05                 ` Måns Rullgård
2015-01-17 16:16               ` Daniel Sanders

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.