<div dir="ltr">The patch you sent does not apply to the current tree. I do not understand what you want to be done.<div><br></div><div>-Mark</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 9, 2015 at 6:20 AM, Daniel Sanders <span dir="ltr"><<a href="mailto:daniel.sanders@imgtec.com" target="_blank">daniel.sanders@imgtec.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Also include the necessary LLVM patch which was previously omitted.<br>
<br>
---<br>
<br>
I've submitted the kernel patch upstream.<br>
<br>
...REAM-mips-Remove-all-instances-of-explici.patch | 426 ---------------------<br>
...-current_thread_info-to-an-equivalent-sup.patch | 50 +++<br>
arch/mips/patches/series | 3 +-<br>
.../clang/patches/llvm/mips-named-registers.patch | 39 ++<br>
toolchain/clang/patches/llvm/series | 1 +<br>
5 files changed, 91 insertions(+), 428 deletions(-)<br>
delete mode 100644 arch/mips/patches/mips-DO-NOT-UPSTREAM-mips-Remove-all-instances-of-explici.patch<br>
create mode 100644 arch/mips/patches/mips-change-current_thread_info-to-an-equivalent-sup.patch<br>
create mode 100644 toolchain/clang/patches/llvm/mips-named-registers.patch<br>
<br>
diff --git a/arch/mips/patches/mips-DO-NOT-UPSTREAM-mips-Remove-all-instances-of-explici.patch b/arch/mips/patches/mips-DO-NOT-UPSTREAM-mips-Remove-all-instances-of-explici.patch<br>
deleted file mode 100644<br>
index c661a8a..0000000<br>
--- a/arch/mips/patches/mips-DO-NOT-UPSTREAM-mips-Remove-all-instances-of-explici.patch<br>
+++ /dev/null<br>
@@ -1,426 +0,0 @@<br>
-From f7d74e066df8cd92e5c310d2354e84e5e26c2dff Mon Sep 17 00:00:00 2001<br>
-From: Daniel Sanders <<a href="mailto:daniel.sanders@imgtec.com">daniel.sanders@imgtec.com</a>><br>
-Date: Fri, 19 Dec 2014 13:48:39 +0000<br>
-Subject: [PATCH 2/2] [DO-NOT-UPSTREAM][mips] Remove all instances of explicit<br>
- register variables from the mips arch.<br>
-<br>
-Clang accepts the syntax but does not honour them. I've asked a colleague to<br>
-look into supporting explicit register variables in clang. For now, remove the<br>
-uses of this feature and accept the unnecessary moves.<br>
-<br>
-Signed-off-by: Daniel Sanders <<a href="mailto:daniel.sanders@imgtec.com">daniel.sanders@imgtec.com</a>><br>
----<br>
- .../mips-remove-explicit-register-variables.patch | 391 +++++++++++++++++++++<br>
- arch/mips/patches/series | 1 +<br>
- 2 files changed, 392 insertions(+)<br>
- create mode 100644 arch/mips/patches/mips-remove-explicit-register-variables.patch<br>
-<br>
-diff --git a/arch/mips/patches/mips-remove-explicit-register-variables.patch b/arch/mips/patches/mips-remove-explicit-register-variables.patch<br>
-new file mode 100644<br>
-index 0000000..320831a<br>
---- /dev/null<br>
-+++ b/arch/mips/patches/mips-remove-explicit-register-variables.patch<br>
-@@ -0,0 +1,391 @@<br>
-+From 437530253edbf21d60e98259096a532a90579b8d Mon Sep 17 00:00:00 2001<br>
-+From: Daniel Sanders <<a href="mailto:daniel.sanders@imgtec.com">daniel.sanders@imgtec.com</a>><br>
-+Date: Fri, 19 Dec 2014 13:44:48 +0000<br>
-+Subject: [PATCH 2/2] [DO-NOT-UPSTREAM][mips] Remove all instances of explicit<br>
-+ register variables from the mips arch.<br>
-+<br>
-+Clang accepts the syntax but does not honour them. I've asked a colleague to<br>
-+look into supporting explicit register variables in clang. For now, remove the<br>
-+uses of this feature and accept the unnecessary moves.<br>
-+<br>
-+Signed-off-by: Daniel Sanders <<a href="mailto:daniel.sanders@imgtec.com">daniel.sanders@imgtec.com</a>><br>
-+---<br>
-+ arch/mips/include/asm/kvm_para.h | 34 ++++++++++-----<br>
-+ arch/mips/include/asm/sgiarcs.h | 42 ++++++++++++------<br>
-+ arch/mips/include/asm/thread_info.h | 4 +-<br>
-+ arch/mips/include/asm/uaccess.h | 85 ++++++++++++++++++++++---------------<br>
-+ arch/mips/lib/uncached.c | 5 ++-<br>
-+ 5 files changed, 108 insertions(+), 62 deletions(-)<br>
-+<br>
-+diff --git a/arch/mips/include/asm/kvm_para.h b/arch/mips/include/asm/kvm_para.h<br>
-+index 5a9aa91..b8e987c 100644<br>
-+--- a/arch/mips/include/asm/kvm_para.h<br>
-++++ b/arch/mips/include/asm/kvm_para.h<br>
-+@@ -14,12 +14,14 @@<br>
-+ */<br>
-+ static inline unsigned long kvm_hypercall0(unsigned long num)<br>
-+ {<br>
-+- register unsigned long n asm("v0");<br>
-+- register unsigned long r asm("v0");<br>
-++ register unsigned long n;<br>
-++ register unsigned long r;<br>
-+<br>
-+ n = num;<br>
-+ __asm__ __volatile__(<br>
-++ "move $v0,%1\n\t"<br>
-+ KVM_HYPERCALL<br>
-++ "move %0,$v0\n\t"<br>
-+ : "=r" (r) : "r" (n) : "memory"<br>
-+ );<br>
-+<br>
-+@@ -29,14 +31,17 @@ static inline unsigned long kvm_hypercall0(unsigned long num)<br>
-+ static inline unsigned long kvm_hypercall1(unsigned long num,<br>
-+ unsigned long arg0)<br>
-+ {<br>
-+- register unsigned long n asm("v0");<br>
-+- register unsigned long r asm("v0");<br>
-+- register unsigned long a0 asm("a0");<br>
-++ register unsigned long n;<br>
-++ register unsigned long r;<br>
-++ register unsigned long a0;<br>
-+<br>
-+ n = num;<br>
-+ a0 = arg0;<br>
-+ __asm__ __volatile__(<br>
-++ "move $v0,%1\n\t"<br>
-++ "move $a0,%2\n\t"<br>
-+ KVM_HYPERCALL<br>
-++ "move %0,$v0\n\t"<br>
-+ : "=r" (r) : "r" (n), "r" (a0) : "memory"<br>
-+ );<br>
-+<br>
-+@@ -55,7 +60,11 @@ static inline unsigned long kvm_hypercall2(unsigned long num,<br>
-+ a0 = arg0;<br>
-+ a1 = arg1;<br>
-+ __asm__ __volatile__(<br>
-++ "move $v0,%1\n\t"<br>
-++ "move $a0,%2\n\t"<br>
-++ "move $a1,%3\n\t"<br>
-+ KVM_HYPERCALL<br>
-++ "move $v0,%0\n\t"<br>
-+ : "=r" (r) : "r" (n), "r" (a0), "r" (a1) : "memory"<br>
-+ );<br>
-+<br>
-+@@ -65,18 +74,23 @@ static inline unsigned long kvm_hypercall2(unsigned long num,<br>
-+ static inline unsigned long kvm_hypercall3(unsigned long num,<br>
-+ unsigned long arg0, unsigned long arg1, unsigned long arg2)<br>
-+ {<br>
-+- register unsigned long n asm("v0");<br>
-+- register unsigned long r asm("v0");<br>
-+- register unsigned long a0 asm("a0");<br>
-+- register unsigned long a1 asm("a1");<br>
-+- register unsigned long a2 asm("a2");<br>
-++ register unsigned long n;<br>
-++ register unsigned long r;<br>
-++ register unsigned long a0;<br>
-++ register unsigned long a1;<br>
-++ register unsigned long a2;<br>
-+<br>
-+ n = num;<br>
-+ a0 = arg0;<br>
-+ a1 = arg1;<br>
-+ a2 = arg2;<br>
-+ __asm__ __volatile__(<br>
-++ "move $v0,%1\n\t"<br>
-++ "move $a0,%2\n\t"<br>
-++ "move $a1,%3\n\t"<br>
-++ "move $a2,%4\n\t"<br>
-+ KVM_HYPERCALL<br>
-++ "move $v0,%0\n\t"<br>
-+ : "=r" (r) : "r" (n), "r" (a0), "r" (a1), "r" (a2) : "memory"<br>
-+ );<br>
-+<br>
-+diff --git a/arch/mips/include/asm/sgiarcs.h b/arch/mips/include/asm/sgiarcs.h<br>
-+index 26ddfff..a62c267 100644<br>
-+--- a/arch/mips/include/asm/sgiarcs.h<br>
-++++ b/arch/mips/include/asm/sgiarcs.h<br>
-+@@ -388,9 +388,10 @@ struct linux_smonblock {<br>
-+<br>
-+ #define ARC_CALL1(dest, a1) \<br>
-+ ({ long __res; \<br>
-+- register signed int __a1 __asm__("$4") = (int) (long) (a1); \<br>
-++ register signed int __a1 = (int) (long) (a1); \<br>
-+ long __vec = (long) romvec->dest; \<br>
-+ __asm__ __volatile__( \<br>
-++ "move\t$4,%3\n\t" \<br>
-+ "dsubu\t$29, 32\n\t" \<br>
-+ "jalr\t%1\n\t" \<br>
-+ "daddu\t$29, 32\n\t" \<br>
-+@@ -403,10 +404,12 @@ struct linux_smonblock {<br>
-+<br>
-+ #define ARC_CALL2(dest, a1, a2) \<br>
-+ ({ long __res; \<br>
-+- register signed int __a1 __asm__("$4") = (int) (long) (a1); \<br>
-+- register signed int __a2 __asm__("$5") = (int) (long) (a2); \<br>
-++ register signed int __a1 = (int) (long) (a1); \<br>
-++ register signed int __a2 = (int) (long) (a2); \<br>
-+ long __vec = (long) romvec->dest; \<br>
-+ __asm__ __volatile__( \<br>
-++ "move\t$4,%3\n\t" \<br>
-++ "move\t$5,%4\n\t" \<br>
-+ "dsubu\t$29, 32\n\t" \<br>
-+ "jalr\t%1\n\t" \<br>
-+ "daddu\t$29, 32\n\t" \<br>
-+@@ -419,11 +422,14 @@ struct linux_smonblock {<br>
-+<br>
-+ #define ARC_CALL3(dest, a1, a2, a3) \<br>
-+ ({ long __res; \<br>
-+- register signed int __a1 __asm__("$4") = (int) (long) (a1); \<br>
-+- register signed int __a2 __asm__("$5") = (int) (long) (a2); \<br>
-+- register signed int __a3 __asm__("$6") = (int) (long) (a3); \<br>
-++ register signed int __a1 = (int) (long) (a1); \<br>
-++ register signed int __a2 = (int) (long) (a2); \<br>
-++ register signed int __a3 = (int) (long) (a3); \<br>
-+ long __vec = (long) romvec->dest; \<br>
-+ __asm__ __volatile__( \<br>
-++ "move\t$4,%3\n\t" \<br>
-++ "move\t$5,%4\n\t" \<br>
-++ "move\t$6,%5\n\t" \<br>
-+ "dsubu\t$29, 32\n\t" \<br>
-+ "jalr\t%1\n\t" \<br>
-+ "daddu\t$29, 32\n\t" \<br>
-+@@ -436,12 +442,16 @@ struct linux_smonblock {<br>
-+<br>
-+ #define ARC_CALL4(dest, a1, a2, a3, a4) \<br>
-+ ({ long __res; \<br>
-+- register signed int __a1 __asm__("$4") = (int) (long) (a1); \<br>
-+- register signed int __a2 __asm__("$5") = (int) (long) (a2); \<br>
-+- register signed int __a3 __asm__("$6") = (int) (long) (a3); \<br>
-+- register signed int __a4 __asm__("$7") = (int) (long) (a4); \<br>
-++ register signed int __a1 = (int) (long) (a1); \<br>
-++ register signed int __a2 = (int) (long) (a2); \<br>
-++ register signed int __a3 = (int) (long) (a3); \<br>
-++ register signed int __a4 = (int) (long) (a4); \<br>
-+ long __vec = (long) romvec->dest; \<br>
-+ __asm__ __volatile__( \<br>
-++ "move\t$4,%3\n\t" \<br>
-++ "move\t$5,%4\n\t" \<br>
-++ "move\t$6,%5\n\t" \<br>
-++ "move\t$7,%6\n\t" \<br>
-+ "dsubu\t$29, 32\n\t" \<br>
-+ "jalr\t%1\n\t" \<br>
-+ "daddu\t$29, 32\n\t" \<br>
-+@@ -455,13 +465,17 @@ struct linux_smonblock {<br>
-+<br>
-+ #define ARC_CALL5(dest, a1, a2, a3, a4, a5) \<br>
-+ ({ long __res; \<br>
-+- register signed int __a1 __asm__("$4") = (int) (long) (a1); \<br>
-+- register signed int __a2 __asm__("$5") = (int) (long) (a2); \<br>
-+- register signed int __a3 __asm__("$6") = (int) (long) (a3); \<br>
-+- register signed int __a4 __asm__("$7") = (int) (long) (a4); \<br>
-++ register signed int __a1 = (int) (long) (a1); \<br>
-++ register signed int __a2 = (int) (long) (a2); \<br>
-++ register signed int __a3 = (int) (long) (a3); \<br>
-++ register signed int __a4 = (int) (long) (a4); \<br>
-+ register signed int __a5 = (int) (long) (a5); \<br>
-+ long __vec = (long) romvec->dest; \<br>
-+ __asm__ __volatile__( \<br>
-++ "move\t$4,%3\n\t" \<br>
-++ "move\t$5,%4\n\t" \<br>
-++ "move\t$6,%5\n\t" \<br>
-++ "move\t$7,%6\n\t" \<br>
-+ "dsubu\t$29, 32\n\t" \<br>
-+ "sw\t%7, 16($29)\n\t" \<br>
-+ "jalr\t%1\n\t" \<br>
-+diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h<br>
-+index 99eea59..c148256 100644<br>
-+--- a/arch/mips/include/asm/thread_info.h<br>
-++++ b/arch/mips/include/asm/thread_info.h<br>
-+@@ -60,7 +60,9 @@ struct thread_info {<br>
-+ /* How to get the thread information struct from C. */<br>
-+ static inline struct thread_info *current_thread_info(void)<br>
-+ {<br>
-+- register struct thread_info *__current_thread_info __asm__("$28");<br>
-++ register struct thread_info *__current_thread_info;<br>
-++<br>
-++ __asm__("move %0, $28": "=r"(__current_thread_info));<br>
-+<br>
-+ return __current_thread_info;<br>
-+ }<br>
-+diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h<br>
-+index bf8b324..96698c6 100644<br>
-+--- a/arch/mips/include/asm/uaccess.h<br>
-++++ b/arch/mips/include/asm/uaccess.h<br>
-+@@ -788,18 +788,21 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);<br>
-+ #ifndef CONFIG_EVA<br>
-+ #define __invoke_copy_to_user(to, from, n) \<br>
-+ ({ \<br>
-+- register void __user *__cu_to_r __asm__("$4"); \<br>
-+- register const void *__cu_from_r __asm__("$5"); \<br>
-+- register long __cu_len_r __asm__("$6"); \<br>
-++ register void __user *__cu_to_r = (to); \<br>
-++ register const void *__cu_from_r = (from); \<br>
-++ register long __cu_len_r = (n); \<br>
-+ \<br>
-+- __cu_to_r = (to); \<br>
-+- __cu_from_r = (from); \<br>
-+- __cu_len_r = (n); \<br>
-+ __asm__ __volatile__( \<br>
-++ "move $4, %0\n\t" \<br>
-++ "move $5, %1\n\t" \<br>
-++ "move $6, %2\n\t" \<br>
-+ __MODULE_JAL(__copy_user) \<br>
-++ "move %0, $4\n\t" \<br>
-++ "move %1, $5\n\t" \<br>
-++ "move %2, $6\n\t" \<br>
-+ : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \<br>
-+ : \<br>
-+- : "$8", "$9", "$10", "$11", "$12", "$14", "$15", "$24", "$31", \<br>
-++ : "$4", "$5", "$6", "$8", "$9", "$10", "$11", "$12", "$14", "$15", "$24", "$31", \<br>
-+ DADDI_SCRATCH, "memory"); \<br>
-+ __cu_len_r; \<br>
-+ })<br>
-+@@ -923,23 +926,26 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);<br>
-+<br>
-+ #define __invoke_copy_from_user(to, from, n) \<br>
-+ ({ \<br>
-+- register void *__cu_to_r __asm__("$4"); \<br>
-+- register const void __user *__cu_from_r __asm__("$5"); \<br>
-+- register long __cu_len_r __asm__("$6"); \<br>
-++ register void *__cu_to_r = (to); \<br>
-++ register const void __user *__cu_from_r = (from); \<br>
-++ register long __cu_len_r = (n); \<br>
-+ \<br>
-+- __cu_to_r = (to); \<br>
-+- __cu_from_r = (from); \<br>
-+- __cu_len_r = (n); \<br>
-+ __asm__ __volatile__( \<br>
-+ ".set\tnoreorder\n\t" \<br>
-++ "move $4, %0\n\t" \<br>
-++ "move $5, %1\n\t" \<br>
-++ "move $6, %2\n\t" \<br>
-+ __MODULE_JAL(__copy_user) \<br>
-+ ".set\tnoat\n\t" \<br>
-+ __UA_ADDU "\t$1, %1, %2\n\t" \<br>
-++ "move %0, $4\n\t" \<br>
-++ "move %1, $5\n\t" \<br>
-++ "move %2, $6\n\t" \<br>
-+ ".set\tat\n\t" \<br>
-+ ".set\treorder" \<br>
-+ : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \<br>
-+ : \<br>
-+- : "$8", "$9", "$10", "$11", "$12", "$14", "$15", "$24", "$31", \<br>
-++ : "$4", "$5", "$6", "$8", "$9", "$10", "$11", "$12", "$14", "$15", "$24", "$31", \<br>
-+ DADDI_SCRATCH, "memory"); \<br>
-+ __cu_len_r; \<br>
-+ })<br>
-+@@ -957,23 +963,26 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);<br>
-+<br>
-+ #define __invoke_copy_from_user_inatomic(to, from, n) \<br>
-+ ({ \<br>
-+- register void *__cu_to_r __asm__("$4"); \<br>
-+- register const void __user *__cu_from_r __asm__("$5"); \<br>
-+- register long __cu_len_r __asm__("$6"); \<br>
-++ register void *__cu_to_r = (to); \<br>
-++ register const void __user *__cu_from_r = (from); \<br>
-++ register long __cu_len_r = (n); \<br>
-+ \<br>
-+- __cu_to_r = (to); \<br>
-+- __cu_from_r = (from); \<br>
-+- __cu_len_r = (n); \<br>
-+ __asm__ __volatile__( \<br>
-+ ".set\tnoreorder\n\t" \<br>
-++ "move $4, %0\n\t" \<br>
-++ "move $5, %1\n\t" \<br>
-++ "move $6, %2\n\t" \<br>
-+ __MODULE_JAL(__copy_user_inatomic) \<br>
-+ ".set\tnoat\n\t" \<br>
-+ __UA_ADDU "\t$1, %1, %2\n\t" \<br>
-++ "move %0, $4\n\t" \<br>
-++ "move %1, $5\n\t" \<br>
-++ "move %2, $6\n\t" \<br>
-+ ".set\tat\n\t" \<br>
-+ ".set\treorder" \<br>
-+ : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \<br>
-+ : \<br>
-+- : "$8", "$9", "$10", "$11", "$12", "$14", "$15", "$24", "$31", \<br>
-++ : "$4", "$5", "$6", "$8", "$9", "$10", "$11", "$12", "$14", "$15", "$24", "$31", \<br>
-+ DADDI_SCRATCH, "memory"); \<br>
-+ __cu_len_r; \<br>
-+ })<br>
-+@@ -995,41 +1004,47 @@ extern size_t __copy_in_user_eva(void *__to, const void *__from, size_t __n);<br>
-+<br>
-+ #define __invoke_copy_from_user_eva_generic(to, from, n, func_ptr) \<br>
-+ ({ \<br>
-+- register void *__cu_to_r __asm__("$4"); \<br>
-+- register const void __user *__cu_from_r __asm__("$5"); \<br>
-+- register long __cu_len_r __asm__("$6"); \<br>
-++ register void *__cu_to_r = (to); \<br>
-++ register const void __user *__cu_from_r = (from); \<br>
-++ register long __cu_len_r = (n); \<br>
-+ \<br>
-+- __cu_to_r = (to); \<br>
-+- __cu_from_r = (from); \<br>
-+- __cu_len_r = (n); \<br>
-+ __asm__ __volatile__( \<br>
-+ ".set\tnoreorder\n\t" \<br>
-++ "move $4, %0\n\t" \<br>
-++ "move $5, %1\n\t" \<br>
-++ "move $6, %2\n\t" \<br>
-+ __MODULE_JAL(func_ptr) \<br>
-+ ".set\tnoat\n\t" \<br>
-+ __UA_ADDU "\t$1, %1, %2\n\t" \<br>
-++ "move %0, $4\n\t" \<br>
-++ "move %1, $5\n\t" \<br>
-++ "move %2, $6\n\t" \<br>
-+ ".set\tat\n\t" \<br>
-+ ".set\treorder" \<br>
-+ : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \<br>
-+ : \<br>
-+- : "$8", "$9", "$10", "$11", "$12", "$14", "$15", "$24", "$31", \<br>
-++ : "$4", "$5", "$6", "$8", "$9", "$10", "$11", "$12", "$14", "$15", "$24", "$31", \<br>
-+ DADDI_SCRATCH, "memory"); \<br>
-+ __cu_len_r; \<br>
-+ })<br>
-+<br>
-+ #define __invoke_copy_to_user_eva_generic(to, from, n, func_ptr) \<br>
-+ ({ \<br>
-+- register void *__cu_to_r __asm__("$4"); \<br>
-+- register const void __user *__cu_from_r __asm__("$5"); \<br>
-+- register long __cu_len_r __asm__("$6"); \<br>
-++ register void *__cu_to_r = (to); \<br>
-++ register const void __user *__cu_from_r = (from); \<br>
-++ register long __cu_len_r = (n); \<br>
-+ \<br>
-+- __cu_to_r = (to); \<br>
-+- __cu_from_r = (from); \<br>
-+- __cu_len_r = (n); \<br>
-+ __asm__ __volatile__( \<br>
-++ "move $4, %0\n\t" \<br>
-++ "move $5, %1\n\t" \<br>
-++ "move $6, %2\n\t" \<br>
-+ __MODULE_JAL(func_ptr) \<br>
-++ "move %0, $4\n\t" \<br>
-++ "move %1, $5\n\t" \<br>
-++ "move %2, $6\n\t" \<br>
-+ : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \<br>
-+ : \<br>
-+- : "$8", "$9", "$10", "$11", "$12", "$14", "$15", "$24", "$31", \<br>
-++ : "$4", "$5", "$6", "$8", "$9", "$10", "$11", "$12", "$14", "$15", "$24", "$31", \<br>
-+ DADDI_SCRATCH, "memory"); \<br>
-+ __cu_len_r; \<br>
-+ })<br>
-+diff --git a/arch/mips/lib/uncached.c b/arch/mips/lib/uncached.c<br>
-+index 09d5dee..c520eb1 100644<br>
-+--- a/arch/mips/lib/uncached.c<br>
-++++ b/arch/mips/lib/uncached.c<br>
-+@@ -37,8 +37,9 @@<br>
-+ */<br>
-+ unsigned long run_uncached(void *func)<br>
-+ {<br>
-+- register long sp __asm__("$sp");<br>
-+- register long ret __asm__("$2");<br>
-++ register long sp;<br>
-++ __asm__ volatile ("move %0, $sp" : "=r"(sp));<br>
-++ register long ret;<br>
-+ long lfunc = (long)func, ufunc;<br>
-+ long usp;<br>
-+<br>
-+--<br>
-+2.1.3<br>
-+<br>
-diff --git a/arch/mips/patches/series b/arch/mips/patches/series<br>
-index 1aaf96a..e219c25 100644<br>
---- a/arch/mips/patches/series<br>
-+++ b/arch/mips/patches/series<br>
-@@ -2,3 +2,4 @@ mips-fix-cast-to-type-not-present-in-union.patch<br>
- mips-fix-inline-asm-input-output-type-mismatch.patch<br>
- mips-silence-variable-self-assignment-warnings.patch<br>
- mips-silence-unicode-warnings.patch<br>
-+mips-remove-explicit-register-variables.patch<br>
---<br>
-2.1.3<br>
-<br>
diff --git a/arch/mips/patches/mips-change-current_thread_info-to-an-equivalent-sup.patch b/arch/mips/patches/mips-change-current_thread_info-to-an-equivalent-sup.patch<br>
new file mode 100644<br>
index 0000000..83b17ce<br>
--- /dev/null<br>
+++ b/arch/mips/patches/mips-change-current_thread_info-to-an-equivalent-sup.patch<br>
@@ -0,0 +1,50 @@<br>
+From 3e8b879d48a805fdad49914259511d7f47b36a73 Mon Sep 17 00:00:00 2001<br>
+From: Daniel Sanders <<a href="mailto:daniel.sanders@imgtec.com">daniel.sanders@imgtec.com</a>><br>
+Date: Fri, 9 Jan 2015 10:54:22 +0000<br>
+Subject: [PATCH] MIPS: Changed current_thread_info() to an equivalent<br>
+ supported by both clang and GCC<br>
+<br>
+Without this, a 'break' instruction is executed very early in the boot and<br>
+the boot hangs.<br>
+<br>
+The problem is that clang doesn't honour named registers on local variables<br>
+and silently treats them as normal uninitialized variables. However, it<br>
+does honour them on global variables.<br>
+<br>
+Signed-off-by: Daniel Sanders <<a href="mailto:daniel.sanders@imgtec.com">daniel.sanders@imgtec.com</a>><br>
+---<br>
+ arch/mips/include/asm/thread_info.h | 6 +++---<br>
+ 1 file changed, 3 insertions(+), 3 deletions(-)<br>
+<br>
+For reference, a similar patch for ARM's stack pointer has already been merged:<br>
+ 0abc08b ARM: 8170/1: Add global named register current_stack_pointer for ARM<br>
+<br>
+This is part of a patch series to get Linux for Mips working when compiled with<br>
+clang. I've chosen to submit this patch individually since it's my first kernel<br>
+patch and I'd like to be sure I'm following your processes correctly before I<br>
+submit all of them.<br>
+<br>
+Please CC me on replies since I'm not subscribed to the mailing list.<br>
+<br>
+diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h<br>
+index 99eea59..2a2f3c4 100644<br>
+--- a/arch/mips/include/asm/thread_info.h<br>
++++ b/arch/mips/include/asm/thread_info.h<br>
+@@ -58,11 +58,11 @@ struct thread_info {<br>
+ #define init_stack (init_thread_union.stack)<br>
+<br>
+ /* How to get the thread information struct from C. */<br>
++register struct thread_info *current_gp_register asm("$28");<br>
++<br>
+ static inline struct thread_info *current_thread_info(void)<br>
+ {<br>
+- register struct thread_info *__current_thread_info __asm__("$28");<br>
+-<br>
+- return __current_thread_info;<br>
++ return current_gp_register;<br>
+ }<br>
+<br>
+ #endif /* !__ASSEMBLY__ */<br>
+--<br>
+2.1.4<br>
+<br>
diff --git a/arch/mips/patches/series b/arch/mips/patches/series<br>
index ad1334a..7fc1a7d 100644<br>
--- a/arch/mips/patches/series<br>
+++ b/arch/mips/patches/series<br>
@@ -2,5 +2,4 @@ mips-fix-cast-to-type-not-present-in-union.patch<br>
mips-fix-inline-asm-input-output-type-mismatch.patch<br>
mips-silence-variable-self-assignment-warnings.patch<br>
mips-silence-unicode-warnings.patch<br>
-mips-WIP-Fix-slab-allocator-bootstrap.patch<br>
-mips-DO-NOT-UPSTREAM-mips-Remove-all-instances-of-explici.patch<br>
+mips-change-current_thread_info-to-an-equivalent-sup.patch<br>
diff --git a/toolchain/clang/patches/llvm/mips-named-registers.patch b/toolchain/clang/patches/llvm/mips-named-registers.patch<br>
new file mode 100644<br>
index 0000000..99d0888<br>
--- /dev/null<br>
+++ b/toolchain/clang/patches/llvm/mips-named-registers.patch<br>
@@ -0,0 +1,39 @@<br>
+--- llvm.orig/lib/Target/Mips/MipsISelLowering.cpp<br>
++++ llvm/lib/Target/Mips/MipsISelLowering.cpp<br>
+@@ -3836,3 +3836,25 @@<br>
+<br>
+ return BB;<br>
+ }<br>
++<br>
++// FIXME? Maybe this could be a TableGen attribute on some registers and<br>
++// this table could be generated automatically from RegInfo.<br>
++unsigned MipsTargetLowering::getRegisterByName(const char* RegName,<br>
++ EVT VT) const {<br>
++ // Named registers is expected to be fairly rare. For now, just support $28<br>
++ // since the linux kernel uses it.<br>
++ if (Subtarget.isGP64bit()) {<br>
++ unsigned Reg = StringSwitch<unsigned>(RegName)<br>
++ .Case("$28", Mips::GP_64)<br>
++ .Default(0);<br>
++ if (Reg)<br>
++ return Reg;<br>
++ } else {<br>
++ unsigned Reg = StringSwitch<unsigned>(RegName)<br>
++ .Case("$28", Mips::GP)<br>
++ .Default(0);<br>
++ if (Reg)<br>
++ return Reg;<br>
++ }<br>
++ report_fatal_error("Invalid register name global variable");<br>
++}<br>
+--- llvm.orig/lib/Target/Mips/MipsISelLowering.h<br>
++++ llvm/lib/Target/Mips/MipsISelLowering.h<br>
+@@ -262,6 +262,8 @@<br>
+<br>
+ void HandleByVal(CCState *, unsigned &, unsigned) const override;<br>
+<br>
++ unsigned getRegisterByName(const char* RegName, EVT VT) const;<br>
++<br>
+ protected:<br>
+ SDValue getGlobalReg(SelectionDAG &DAG, EVT Ty) const;<br>
+<br>
diff --git a/toolchain/clang/patches/llvm/series b/toolchain/clang/patches/llvm/series<br>
index f0b4536..b65b208 100644<br>
--- a/toolchain/clang/patches/llvm/series<br>
+++ b/toolchain/clang/patches/llvm/series<br>
@@ -1 +1,2 @@<br>
call_graph.patch<br>
+mips-named-registers.patch<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.1.4<br>
<br>
_______________________________________________<br>
LLVMLinux mailing list<br>
<a href="mailto:LLVMLinux@lists.linuxfoundation.org">LLVMLinux@lists.linuxfoundation.org</a><br>
<a href="https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux" target="_blank">https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux</a><br>
</font></span></blockquote></div><br></div>