Commit eab0c72a authored by Rusty Russell's avatar Rusty Russell Committed by Andi Kleen

[PATCH] x86-64: Introduce load_TLS to the "for" loop.

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: default avatarRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 692174b9
...@@ -135,16 +135,13 @@ static inline void set_ldt_desc(unsigned cpu, void *addr, int size) ...@@ -135,16 +135,13 @@ static inline void set_ldt_desc(unsigned cpu, void *addr, int size)
(info)->useable == 0 && \ (info)->useable == 0 && \
(info)->lm == 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) 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); u64 *gdt = (u64 *)(cpu_gdt(cpu) + GDT_ENTRY_TLS_MIN);
gdt[0] = t->tls_array[0];
gdt[1] = t->tls_array[1]; for (i = 0; i < GDT_ENTRY_TLS_ENTRIES; i++)
gdt[2] = t->tls_array[2]; gdt[i] = t->tls_array[i];
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment