<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">&lt;<a href="mailto:daniel.sanders@imgtec.com" target="_blank">daniel.sanders@imgtec.com</a>&gt;</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&#39;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 &lt;<a href="mailto:daniel.sanders@imgtec.com">daniel.sanders@imgtec.com</a>&gt;<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&#39;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 &lt;<a href="mailto:daniel.sanders@imgtec.com">daniel.sanders@imgtec.com</a>&gt;<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 &lt;<a href="mailto:daniel.sanders@imgtec.com">daniel.sanders@imgtec.com</a>&gt;<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&#39;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 &lt;<a href="mailto:daniel.sanders@imgtec.com">daniel.sanders@imgtec.com</a>&gt;<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(&quot;v0&quot;);<br>
-+-     register unsigned long r asm(&quot;v0&quot;);<br>
-++     register unsigned long n;<br>
-++     register unsigned long r;<br>
-+<br>
-+      n = num;<br>
-+      __asm__ __volatile__(<br>
-++                &quot;move $v0,%1\n\t&quot;<br>
-+              KVM_HYPERCALL<br>
-++                &quot;move %0,$v0\n\t&quot;<br>
-+              : &quot;=r&quot; (r) : &quot;r&quot; (n) : &quot;memory&quot;<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(&quot;v0&quot;);<br>
-+-     register unsigned long r asm(&quot;v0&quot;);<br>
-+-     register unsigned long a0 asm(&quot;a0&quot;);<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>
-++                &quot;move $v0,%1\n\t&quot;<br>
-++                &quot;move $a0,%2\n\t&quot;<br>
-+              KVM_HYPERCALL<br>
-++                &quot;move %0,$v0\n\t&quot;<br>
-+              : &quot;=r&quot; (r) : &quot;r&quot; (n), &quot;r&quot; (a0) : &quot;memory&quot;<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>
-++                &quot;move $v0,%1\n\t&quot;<br>
-++                &quot;move $a0,%2\n\t&quot;<br>
-++                &quot;move $a1,%3\n\t&quot;<br>
-+              KVM_HYPERCALL<br>
-++                &quot;move $v0,%0\n\t&quot;<br>
-+              : &quot;=r&quot; (r) : &quot;r&quot; (n), &quot;r&quot; (a0), &quot;r&quot; (a1) : &quot;memory&quot;<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(&quot;v0&quot;);<br>
-+-     register unsigned long r asm(&quot;v0&quot;);<br>
-+-     register unsigned long a0 asm(&quot;a0&quot;);<br>
-+-     register unsigned long a1 asm(&quot;a1&quot;);<br>
-+-     register unsigned long a2 asm(&quot;a2&quot;);<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>
-++                &quot;move $v0,%1\n\t&quot;<br>
-++                &quot;move $a0,%2\n\t&quot;<br>
-++                &quot;move $a1,%3\n\t&quot;<br>
-++                &quot;move $a2,%4\n\t&quot;<br>
-+              KVM_HYPERCALL<br>
-++                &quot;move $v0,%0\n\t&quot;<br>
-+              : &quot;=r&quot; (r) : &quot;r&quot; (n), &quot;r&quot; (a0), &quot;r&quot; (a1), &quot;r&quot; (a2) : &quot;memory&quot;<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__(&quot;$4&quot;) = (int) (long) (a1);     \<br>
-++     register signed int __a1 = (int) (long) (a1);   \<br>
-+      long __vec = (long) romvec-&gt;dest;                               \<br>
-+      __asm__ __volatile__(                                           \<br>
-++        &quot;move\t$4,%3\n\t&quot; \<br>
-+      &quot;dsubu\t$29, 32\n\t&quot;                                            \<br>
-+      &quot;jalr\t%1\n\t&quot;                                                  \<br>
-+      &quot;daddu\t$29, 32\n\t&quot;                                            \<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__(&quot;$4&quot;) = (int) (long) (a1);     \<br>
-+-     register signed int __a2 __asm__(&quot;$5&quot;) = (int) (long) (a2);     \<br>
-++     register signed int __a1 = (int) (long) (a1);   \<br>
-++     register signed int __a2 = (int) (long) (a2);   \<br>
-+      long __vec = (long) romvec-&gt;dest;                               \<br>
-+      __asm__ __volatile__(                                           \<br>
-++        &quot;move\t$4,%3\n\t&quot; \<br>
-++        &quot;move\t$5,%4\n\t&quot; \<br>
-+      &quot;dsubu\t$29, 32\n\t&quot;                                            \<br>
-+      &quot;jalr\t%1\n\t&quot;                                                  \<br>
-+      &quot;daddu\t$29, 32\n\t&quot;                                            \<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__(&quot;$4&quot;) = (int) (long) (a1);     \<br>
-+-     register signed int __a2 __asm__(&quot;$5&quot;) = (int) (long) (a2);     \<br>
-+-     register signed int __a3 __asm__(&quot;$6&quot;) = (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-&gt;dest;                               \<br>
-+      __asm__ __volatile__(                                           \<br>
-++        &quot;move\t$4,%3\n\t&quot; \<br>
-++        &quot;move\t$5,%4\n\t&quot; \<br>
-++        &quot;move\t$6,%5\n\t&quot; \<br>
-+      &quot;dsubu\t$29, 32\n\t&quot;                                            \<br>
-+      &quot;jalr\t%1\n\t&quot;                                                  \<br>
-+      &quot;daddu\t$29, 32\n\t&quot;                                            \<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__(&quot;$4&quot;) = (int) (long) (a1);     \<br>
-+-     register signed int __a2 __asm__(&quot;$5&quot;) = (int) (long) (a2);     \<br>
-+-     register signed int __a3 __asm__(&quot;$6&quot;) = (int) (long) (a3);     \<br>
-+-     register signed int __a4 __asm__(&quot;$7&quot;) = (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-&gt;dest;                               \<br>
-+      __asm__ __volatile__(                                           \<br>
-++        &quot;move\t$4,%3\n\t&quot; \<br>
-++        &quot;move\t$5,%4\n\t&quot; \<br>
-++        &quot;move\t$6,%5\n\t&quot; \<br>
-++        &quot;move\t$7,%6\n\t&quot; \<br>
-+      &quot;dsubu\t$29, 32\n\t&quot;                                            \<br>
-+      &quot;jalr\t%1\n\t&quot;                                                  \<br>
-+      &quot;daddu\t$29, 32\n\t&quot;                                            \<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__(&quot;$4&quot;) = (int) (long) (a1);     \<br>
-+-     register signed int __a2 __asm__(&quot;$5&quot;) = (int) (long) (a2);     \<br>
-+-     register signed int __a3 __asm__(&quot;$6&quot;) = (int) (long) (a3);     \<br>
-+-     register signed int __a4 __asm__(&quot;$7&quot;) = (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-&gt;dest;                               \<br>
-+      __asm__ __volatile__(                                           \<br>
-++        &quot;move\t$4,%3\n\t&quot; \<br>
-++        &quot;move\t$5,%4\n\t&quot; \<br>
-++        &quot;move\t$6,%5\n\t&quot; \<br>
-++        &quot;move\t$7,%6\n\t&quot; \<br>
-+      &quot;dsubu\t$29, 32\n\t&quot;                                            \<br>
-+      &quot;sw\t%7, 16($29)\n\t&quot;                                           \<br>
-+      &quot;jalr\t%1\n\t&quot;                                                  \<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__(&quot;$28&quot;);<br>
-++     register struct thread_info *__current_thread_info;<br>
-++<br>
-++        __asm__(&quot;move %0, $28&quot;: &quot;=r&quot;(__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__(&quot;$4&quot;);                  \<br>
-+-     register const void *__cu_from_r __asm__(&quot;$5&quot;);                 \<br>
-+-     register long __cu_len_r __asm__(&quot;$6&quot;);                         \<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>
-++        &quot;move $4, %0\n\t&quot;                                                   \<br>
-++        &quot;move $5, %1\n\t&quot;                                                   \<br>
-++        &quot;move $6, %2\n\t&quot;                                                   \<br>
-+      __MODULE_JAL(__copy_user)                                       \<br>
-++        &quot;move %0, $4\n\t&quot;                                                   \<br>
-++        &quot;move %1, $5\n\t&quot;                                                   \<br>
-++        &quot;move %2, $6\n\t&quot;                                                   \<br>
-+      : &quot;+r&quot; (__cu_to_r), &quot;+r&quot; (__cu_from_r), &quot;+r&quot; (__cu_len_r)       \<br>
-+      :                                                               \<br>
-+-     : &quot;$8&quot;, &quot;$9&quot;, &quot;$10&quot;, &quot;$11&quot;, &quot;$12&quot;, &quot;$14&quot;, &quot;$15&quot;, &quot;$24&quot;, &quot;$31&quot;,  \<br>
-++     : &quot;$4&quot;, &quot;$5&quot;, &quot;$6&quot;, &quot;$8&quot;, &quot;$9&quot;, &quot;$10&quot;, &quot;$11&quot;, &quot;$12&quot;, &quot;$14&quot;, &quot;$15&quot;, &quot;$24&quot;, &quot;$31&quot;,        \<br>
-+        DADDI_SCRATCH, &quot;memory&quot;);                                     \<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__(&quot;$4&quot;);                         \<br>
-+-     register const void __user *__cu_from_r __asm__(&quot;$5&quot;);          \<br>
-+-     register long __cu_len_r __asm__(&quot;$6&quot;);                         \<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>
-+      &quot;.set\tnoreorder\n\t&quot;                                           \<br>
-++        &quot;move $4, %0\n\t&quot;                                                   \<br>
-++        &quot;move $5, %1\n\t&quot;                                                   \<br>
-++        &quot;move $6, %2\n\t&quot;                                                   \<br>
-+      __MODULE_JAL(__copy_user)                                       \<br>
-+      &quot;.set\tnoat\n\t&quot;                                                \<br>
-+      __UA_ADDU &quot;\t$1, %1, %2\n\t&quot;                                    \<br>
-++        &quot;move %0, $4\n\t&quot;                                                   \<br>
-++        &quot;move %1, $5\n\t&quot;                                                   \<br>
-++        &quot;move %2, $6\n\t&quot;                                                   \<br>
-+      &quot;.set\tat\n\t&quot;                                                  \<br>
-+      &quot;.set\treorder&quot;                                                 \<br>
-+      : &quot;+r&quot; (__cu_to_r), &quot;+r&quot; (__cu_from_r), &quot;+r&quot; (__cu_len_r)       \<br>
-+      :                                                               \<br>
-+-     : &quot;$8&quot;, &quot;$9&quot;, &quot;$10&quot;, &quot;$11&quot;, &quot;$12&quot;, &quot;$14&quot;, &quot;$15&quot;, &quot;$24&quot;, &quot;$31&quot;,  \<br>
-++     : &quot;$4&quot;, &quot;$5&quot;, &quot;$6&quot;, &quot;$8&quot;, &quot;$9&quot;, &quot;$10&quot;, &quot;$11&quot;, &quot;$12&quot;, &quot;$14&quot;, &quot;$15&quot;, &quot;$24&quot;, &quot;$31&quot;,        \<br>
-+        DADDI_SCRATCH, &quot;memory&quot;);                                     \<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__(&quot;$4&quot;);                         \<br>
-+-     register const void __user *__cu_from_r __asm__(&quot;$5&quot;);          \<br>
-+-     register long __cu_len_r __asm__(&quot;$6&quot;);                         \<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>
-+      &quot;.set\tnoreorder\n\t&quot;                                           \<br>
-++        &quot;move $4, %0\n\t&quot;                                                   \<br>
-++        &quot;move $5, %1\n\t&quot;                                                   \<br>
-++        &quot;move $6, %2\n\t&quot;                                                   \<br>
-+      __MODULE_JAL(__copy_user_inatomic)                              \<br>
-+      &quot;.set\tnoat\n\t&quot;                                                \<br>
-+      __UA_ADDU &quot;\t$1, %1, %2\n\t&quot;                                    \<br>
-++        &quot;move %0, $4\n\t&quot;                                                   \<br>
-++        &quot;move %1, $5\n\t&quot;                                                   \<br>
-++        &quot;move %2, $6\n\t&quot;                                                   \<br>
-+      &quot;.set\tat\n\t&quot;                                                  \<br>
-+      &quot;.set\treorder&quot;                                                 \<br>
-+      : &quot;+r&quot; (__cu_to_r), &quot;+r&quot; (__cu_from_r), &quot;+r&quot; (__cu_len_r)       \<br>
-+      :                                                               \<br>
-+-     : &quot;$8&quot;, &quot;$9&quot;, &quot;$10&quot;, &quot;$11&quot;, &quot;$12&quot;, &quot;$14&quot;, &quot;$15&quot;, &quot;$24&quot;, &quot;$31&quot;,  \<br>
-++     : &quot;$4&quot;, &quot;$5&quot;, &quot;$6&quot;, &quot;$8&quot;, &quot;$9&quot;, &quot;$10&quot;, &quot;$11&quot;, &quot;$12&quot;, &quot;$14&quot;, &quot;$15&quot;, &quot;$24&quot;, &quot;$31&quot;,        \<br>
-+        DADDI_SCRATCH, &quot;memory&quot;);                                     \<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__(&quot;$4&quot;);                         \<br>
-+-     register const void __user *__cu_from_r __asm__(&quot;$5&quot;);          \<br>
-+-     register long __cu_len_r __asm__(&quot;$6&quot;);                         \<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>
-+      &quot;.set\tnoreorder\n\t&quot;                                           \<br>
-++        &quot;move $4, %0\n\t&quot;                                                   \<br>
-++        &quot;move $5, %1\n\t&quot;                                                   \<br>
-++        &quot;move $6, %2\n\t&quot;                                                   \<br>
-+      __MODULE_JAL(func_ptr)                                          \<br>
-+      &quot;.set\tnoat\n\t&quot;                                                \<br>
-+      __UA_ADDU &quot;\t$1, %1, %2\n\t&quot;                                    \<br>
-++        &quot;move %0, $4\n\t&quot;                                                   \<br>
-++        &quot;move %1, $5\n\t&quot;                                                   \<br>
-++        &quot;move %2, $6\n\t&quot;                                                   \<br>
-+      &quot;.set\tat\n\t&quot;                                                  \<br>
-+      &quot;.set\treorder&quot;                                                 \<br>
-+      : &quot;+r&quot; (__cu_to_r), &quot;+r&quot; (__cu_from_r), &quot;+r&quot; (__cu_len_r)       \<br>
-+      :                                                               \<br>
-+-     : &quot;$8&quot;, &quot;$9&quot;, &quot;$10&quot;, &quot;$11&quot;, &quot;$12&quot;, &quot;$14&quot;, &quot;$15&quot;, &quot;$24&quot;, &quot;$31&quot;,  \<br>
-++     : &quot;$4&quot;, &quot;$5&quot;, &quot;$6&quot;, &quot;$8&quot;, &quot;$9&quot;, &quot;$10&quot;, &quot;$11&quot;, &quot;$12&quot;, &quot;$14&quot;, &quot;$15&quot;, &quot;$24&quot;, &quot;$31&quot;,        \<br>
-+        DADDI_SCRATCH, &quot;memory&quot;);                                     \<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__(&quot;$4&quot;);                         \<br>
-+-     register const void __user *__cu_from_r __asm__(&quot;$5&quot;);          \<br>
-+-     register long __cu_len_r __asm__(&quot;$6&quot;);                         \<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>
-++        &quot;move $4, %0\n\t&quot;                                                   \<br>
-++        &quot;move $5, %1\n\t&quot;                                                   \<br>
-++        &quot;move $6, %2\n\t&quot;                                                   \<br>
-+      __MODULE_JAL(func_ptr)                                          \<br>
-++        &quot;move %0, $4\n\t&quot;                                                   \<br>
-++        &quot;move %1, $5\n\t&quot;                                                   \<br>
-++        &quot;move %2, $6\n\t&quot;                                                   \<br>
-+      : &quot;+r&quot; (__cu_to_r), &quot;+r&quot; (__cu_from_r), &quot;+r&quot; (__cu_len_r)       \<br>
-+      :                                                               \<br>
-+-     : &quot;$8&quot;, &quot;$9&quot;, &quot;$10&quot;, &quot;$11&quot;, &quot;$12&quot;, &quot;$14&quot;, &quot;$15&quot;, &quot;$24&quot;, &quot;$31&quot;,  \<br>
-++     : &quot;$4&quot;, &quot;$5&quot;, &quot;$6&quot;, &quot;$8&quot;, &quot;$9&quot;, &quot;$10&quot;, &quot;$11&quot;, &quot;$12&quot;, &quot;$14&quot;, &quot;$15&quot;, &quot;$24&quot;, &quot;$31&quot;,        \<br>
-+        DADDI_SCRATCH, &quot;memory&quot;);                                     \<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__(&quot;$sp&quot;);<br>
-+-     register long ret __asm__(&quot;$2&quot;);<br>
-++     register long sp;<br>
-++        __asm__ volatile (&quot;move %0, $sp&quot; : &quot;=r&quot;(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 &lt;<a href="mailto:daniel.sanders@imgtec.com">daniel.sanders@imgtec.com</a>&gt;<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 &#39;break&#39; instruction is executed very early in the boot and<br>
+the boot hangs.<br>
+<br>
+The problem is that clang doesn&#39;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 &lt;<a href="mailto:daniel.sanders@imgtec.com">daniel.sanders@imgtec.com</a>&gt;<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&#39;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&#39;ve chosen to submit this patch individually since it&#39;s my first kernel<br>
+patch and I&#39;d like to be sure I&#39;m following your processes correctly before I<br>
+submit all of them.<br>
+<br>
+Please CC me on replies since I&#39;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(&quot;$28&quot;);<br>
++<br>
+ static inline struct thread_info *current_thread_info(void)<br>
+ {<br>
+-      register struct thread_info *__current_thread_info __asm__(&quot;$28&quot;);<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&lt;unsigned&gt;(RegName)<br>
++                         .Case(&quot;$28&quot;, Mips::GP_64)<br>
++                         .Default(0);<br>
++    if (Reg)<br>
++      return Reg;<br>
++  } else {<br>
++    unsigned Reg = StringSwitch&lt;unsigned&gt;(RegName)<br>
++                         .Case(&quot;$28&quot;, Mips::GP)<br>
++                         .Default(0);<br>
++    if (Reg)<br>
++      return Reg;<br>
++  }<br>
++  report_fatal_error(&quot;Invalid register name global variable&quot;);<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 &amp;, unsigned) const override;<br>
+<br>
++    unsigned getRegisterByName(const char* RegName, EVT VT) const;<br>
++<br>
+   protected:<br>
+     SDValue getGlobalReg(SelectionDAG &amp;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>