aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-x86/desc_32.h15
-rw-r--r--include/asm-x86/desc_64.h4
-rw-r--r--include/asm-x86/desc_defs.h8
3 files changed, 17 insertions, 10 deletions
diff --git a/include/asm-x86/desc_32.h b/include/asm-x86/desc_32.h
index bc5ca3453466..77f1e5a4ad7c 100644
--- a/include/asm-x86/desc_32.h
+++ b/include/asm-x86/desc_32.h
@@ -3,6 +3,7 @@
3 3
4#include <asm/ldt.h> 4#include <asm/ldt.h>
5#include <asm/segment.h> 5#include <asm/segment.h>
6#include <asm/desc_defs.h>
6 7
7#ifndef __ASSEMBLY__ 8#ifndef __ASSEMBLY__
8 9
@@ -24,7 +25,7 @@ static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu)
24} 25}
25 26
26extern struct desc_ptr idt_descr; 27extern struct desc_ptr idt_descr;
27extern struct desc_struct idt_table[]; 28extern gate_desc idt_table[];
28extern void set_intr_gate(unsigned int irq, void * addr); 29extern void set_intr_gate(unsigned int irq, void * addr);
29 30
30static inline void pack_descriptor(__u32 *a, __u32 *b, 31static inline void pack_descriptor(__u32 *a, __u32 *b,
@@ -35,11 +36,11 @@ static inline void pack_descriptor(__u32 *a, __u32 *b,
35 (limit & 0x000f0000) | ((type & 0xff) << 8) | ((flags & 0xf) << 20); 36 (limit & 0x000f0000) | ((type & 0xff) << 8) | ((flags & 0xf) << 20);
36} 37}
37 38
38static inline void pack_gate(__u32 *a, __u32 *b, 39static inline void pack_gate(gate_desc *gate,
39 unsigned long base, unsigned short seg, unsigned char type, unsigned char flags) 40 unsigned long base, unsigned short seg, unsigned char type, unsigned char flags)
40{ 41{
41 *a = (seg << 16) | (base & 0xffff); 42 gate->a = (seg << 16) | (base & 0xffff);
42 *b = (base & 0xffff0000) | ((type & 0xff) << 8) | (flags & 0xff); 43 gate->b = (base & 0xffff0000) | ((type & 0xff) << 8) | (flags & 0xff);
43} 44}
44 45
45#define DESCTYPE_LDT 0x82 /* present, system, DPL-0, LDT */ 46#define DESCTYPE_LDT 0x82 /* present, system, DPL-0, LDT */
@@ -139,9 +140,9 @@ static inline void native_load_tls(struct thread_struct *t, unsigned int cpu)
139 140
140static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned short seg) 141static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned short seg)
141{ 142{
142 __u32 a, b; 143 gate_desc g;
143 pack_gate(&a, &b, (unsigned long)addr, seg, type, 0); 144 pack_gate(&g, (unsigned long)addr, seg, type, 0);
144 write_idt_entry(idt_table, gate, a, b); 145 write_idt_entry(idt_table, gate, g.a, g.b);
145} 146}
146 147
147static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const void *addr) 148static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const void *addr)
diff --git a/include/asm-x86/desc_64.h b/include/asm-x86/desc_64.h
index 8bd84a4ef2d5..887393f044b1 100644
--- a/include/asm-x86/desc_64.h
+++ b/include/asm-x86/desc_64.h
@@ -30,7 +30,7 @@ static inline unsigned long __store_tr(void)
30 30
31#define store_tr(tr) (tr) = __store_tr() 31#define store_tr(tr) (tr) = __store_tr()
32 32
33extern struct gate_struct idt_table[]; 33extern gate_desc idt_table[];
34extern struct desc_ptr cpu_gdt_descr[]; 34extern struct desc_ptr cpu_gdt_descr[];
35 35
36static inline void write_ldt_entry(struct desc_struct *ldt, 36static inline void write_ldt_entry(struct desc_struct *ldt,
@@ -58,7 +58,7 @@ static inline void store_gdt(struct desc_ptr *ptr)
58static inline void _set_gate(void *adr, unsigned type, unsigned long func, 58static inline void _set_gate(void *adr, unsigned type, unsigned long func,
59 unsigned dpl, unsigned ist) 59 unsigned dpl, unsigned ist)
60{ 60{
61 struct gate_struct s; 61 gate_desc s;
62 62
63 s.offset_low = PTR_LOW(func); 63 s.offset_low = PTR_LOW(func);
64 s.segment = __KERNEL_CS; 64 s.segment = __KERNEL_CS;
diff --git a/include/asm-x86/desc_defs.h b/include/asm-x86/desc_defs.h
index de47eb0a23aa..9732285116af 100644
--- a/include/asm-x86/desc_defs.h
+++ b/include/asm-x86/desc_defs.h
@@ -39,7 +39,7 @@ enum {
39}; 39};
40 40
41// 16byte gate 41// 16byte gate
42struct gate_struct { 42struct gate_struct64 {
43 u16 offset_low; 43 u16 offset_low;
44 u16 segment; 44 u16 segment;
45 unsigned ist : 3, zero0 : 5, type : 5, dpl : 2, p : 1; 45 unsigned ist : 3, zero0 : 5, type : 5, dpl : 2, p : 1;
@@ -67,6 +67,12 @@ struct ldttss_desc {
67 u32 zero1; 67 u32 zero1;
68} __attribute__((packed)); 68} __attribute__((packed));
69 69
70#ifdef CONFIG_X86_64
71typedef struct gate_struct64 gate_desc;
72#else
73typedef struct desc_struct gate_desc;
74#endif
75
70struct desc_ptr { 76struct desc_ptr {
71 unsigned short size; 77 unsigned short size;
72 unsigned long address; 78 unsigned long address;