Skip to content

Commit

Permalink
[PATCH] x86-64: Introduce load_TLS to the "for" loop.
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
Rusty Russell authored and Andi Kleen committed May 2, 2007
1 parent 692174b commit eab0c72
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions include/asm-x86_64/desc.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,13 @@ static inline void set_ldt_desc(unsigned cpu, void *addr, int size)
(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];
}

/*
Expand Down

0 comments on commit eab0c72

Please sign in to comment.