linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Introduce load_TLS to the "for" loop.
@ 2007-03-13  6:39 Rusty Russell
  2007-03-13 13:50 ` Andi Kleen
  0 siblings, 1 reply; 6+ messages in thread
From: Rusty Russell @ 2007-03-13  6:39 UTC (permalink / raw)
  To: Andi Kleen; +Cc: lkml - Kernel Mailing List

GCC (4.1 at least) unrolls it anyway, but I can't believe this code
was ever justifiable.  (I've also submitted a patch which cleans up
i386, which is even uglier).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

diff -r de5618b5e562 include/asm-x86_64/desc.h
--- a/include/asm-x86_64/desc.h	Tue Mar 13 11:41:55 2007 +1100
+++ b/include/asm-x86_64/desc.h	Tue Mar 13 16:09:56 2007 +1100
@@ -135,16 +135,13 @@ static inline void set_ldt_desc(unsigned
 	(info)->useable		== 0	&& \
 	(info)->lm		== 0)
 
-#if TLS_SIZE != 24
-# error update this code.
-#endif
-
 static inline void load_TLS(struct thread_struct *t, unsigned int cpu)
 {
+	unsigned int i;
 	u64 *gdt = (u64 *)(cpu_gdt(cpu) + GDT_ENTRY_TLS_MIN);
-	gdt[0] = t->tls_array[0];
-	gdt[1] = t->tls_array[1];
-	gdt[2] = t->tls_array[2];
+
+	for (i = 0; i < GDT_ENTRY_TLS_ENTRIES; i++)
+		gdt[i] = t->tls_array[i];
 } 
 
 /*



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

end of thread, other threads:[~2007-03-14  6:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-13  6:39 [PATCH] Introduce load_TLS to the "for" loop Rusty Russell
2007-03-13 13:50 ` Andi Kleen
2007-03-13 17:31   ` Jeremy Fitzhardinge
2007-03-13 20:55     ` Andi Kleen
2007-03-14  6:43       ` Rusty Russell
2007-03-14  6:31   ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).