X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fasm-i386%2Fdesc.h;h=7a0e2feb9f98c532eca8461db8dcfd8f6b207c54;hb=f5223a4ce011c9dcbc6a0b413b4503e98470e753;hp=9361aff2e25c2a2bee549f054c33b50dd0142d5d;hpb=daddc0d38b3571bed170afa273a49a0eba090c1e;p=linux-2.6.git diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h index 9361aff2e..7a0e2feb9 100644 --- a/include/asm-i386/desc.h +++ b/include/asm-i386/desc.h @@ -8,10 +8,12 @@ #include #include +#include #include -extern struct desc_struct cpu_gdt_table[NR_CPUS][GDT_ENTRIES]; +extern struct desc_struct cpu_gdt_table[GDT_ENTRIES]; +DECLARE_PER_CPU(struct desc_struct, cpu_gdt_table[GDT_ENTRIES]); struct Xgt_desc_struct { unsigned short size; @@ -44,14 +46,15 @@ __asm__ __volatile__ ("movw %w3,0(%2)\n\t" \ static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, void *addr) { - _set_tssldt_desc(&cpu_gdt_table[cpu][entry], (int)addr, 235, 0x89); + _set_tssldt_desc(&per_cpu(cpu_gdt_table, cpu)[entry], (int)addr, + offsetof(struct tss_struct, __cacheline_filler) - 1, 0x89); } #define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr) static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int size) { - _set_tssldt_desc(&cpu_gdt_table[cpu][GDT_ENTRY_LDT], (int)addr, ((size << 3)-1), 0x82); + _set_tssldt_desc(&per_cpu(cpu_gdt_table, cpu)[GDT_ENTRY_LDT], (int)addr, ((size << 3)-1), 0x82); } #define LDT_entry_a(info) \ @@ -85,7 +88,7 @@ static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int size) static inline void load_TLS(struct thread_struct *t, unsigned int cpu) { -#define C(i) cpu_gdt_table[cpu][GDT_ENTRY_TLS_MIN + i] = t->tls_array[i] +#define C(i) per_cpu(cpu_gdt_table, cpu)[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i] C(0); C(1); C(2); #undef C } @@ -123,6 +126,20 @@ static inline void load_LDT(mm_context_t *pc) put_cpu(); } +static inline void set_user_cs(struct desc_struct *desc, unsigned long limit) +{ + limit = (limit - 1) / PAGE_SIZE; + desc->a = limit & 0xffff; + desc->b = (limit & 0xf0000) | 0x00c0fb00; +} + +#define load_user_cs_desc(cpu, mm) \ + per_cpu(cpu_gdt_table, cpu)[GDT_ENTRY_DEFAULT_USER_CS] = (mm)->context.user_cs + +extern void arch_add_exec_range(struct mm_struct *mm, unsigned long limit); +extern void arch_remove_exec_range(struct mm_struct *mm, unsigned long limit); +extern void arch_flush_exec_range(struct mm_struct *mm); + #endif /* !__ASSEMBLY__ */ #endif