diff options
Diffstat (limited to 'include/asm-i386/desc.h')
-rw-r--r-- | include/asm-i386/desc.h | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h index f19820f0834f..f398cc456448 100644 --- a/include/asm-i386/desc.h +++ b/include/asm-i386/desc.h | |||
@@ -81,31 +81,15 @@ static inline void load_TLS(struct thread_struct *t, unsigned int cpu) | |||
81 | #undef C | 81 | #undef C |
82 | } | 82 | } |
83 | 83 | ||
84 | static inline void write_dt_entry(void *dt, int entry, __u32 entry_a, __u32 entry_b) | ||
85 | { | ||
86 | __u32 *lp = (__u32 *)((char *)dt + entry*8); | ||
87 | *lp = entry_a; | ||
88 | *(lp+1) = entry_b; | ||
89 | } | ||
90 | |||
91 | #define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) | 84 | #define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) |
92 | #define write_gdt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) | 85 | #define write_gdt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) |
93 | #define write_idt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) | 86 | #define write_idt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) |
94 | 87 | ||
95 | static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned short seg) | 88 | static inline void write_dt_entry(void *dt, int entry, __u32 entry_a, __u32 entry_b) |
96 | { | ||
97 | __u32 a, b; | ||
98 | pack_gate(&a, &b, (unsigned long)addr, seg, type, 0); | ||
99 | write_idt_entry(idt_table, gate, a, b); | ||
100 | } | ||
101 | |||
102 | static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const void *addr) | ||
103 | { | 89 | { |
104 | __u32 a, b; | 90 | __u32 *lp = (__u32 *)((char *)dt + entry*8); |
105 | pack_descriptor(&a, &b, (unsigned long)addr, | 91 | *lp = entry_a; |
106 | offsetof(struct tss_struct, __cacheline_filler) - 1, | 92 | *(lp+1) = entry_b; |
107 | DESCTYPE_TSS, 0); | ||
108 | write_gdt_entry(get_cpu_gdt_table(cpu), entry, a, b); | ||
109 | } | 93 | } |
110 | 94 | ||
111 | #define set_ldt native_set_ldt | 95 | #define set_ldt native_set_ldt |
@@ -128,6 +112,23 @@ static inline fastcall void native_set_ldt(const void *addr, | |||
128 | } | 112 | } |
129 | } | 113 | } |
130 | 114 | ||
115 | static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned short seg) | ||
116 | { | ||
117 | __u32 a, b; | ||
118 | pack_gate(&a, &b, (unsigned long)addr, seg, type, 0); | ||
119 | write_idt_entry(idt_table, gate, a, b); | ||
120 | } | ||
121 | |||
122 | static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const void *addr) | ||
123 | { | ||
124 | __u32 a, b; | ||
125 | pack_descriptor(&a, &b, (unsigned long)addr, | ||
126 | offsetof(struct tss_struct, __cacheline_filler) - 1, | ||
127 | DESCTYPE_TSS, 0); | ||
128 | write_gdt_entry(get_cpu_gdt_table(cpu), entry, a, b); | ||
129 | } | ||
130 | |||
131 | |||
131 | #define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr) | 132 | #define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr) |
132 | 133 | ||
133 | #define LDT_entry_a(info) \ | 134 | #define LDT_entry_a(info) \ |