aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/desc_64.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-01-30 07:30:13 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:30:13 -0500
commit4edc8f5454814201d2fb222354284365b4f0537c (patch)
tree1f50a86bad59b44c5036ecb3c8da2c8e52d59f0e /include/asm-x86/desc_64.h
parent78aa1f66f77da078357bd263fcac95fbf6bca15b (diff)
x86: clean up include/asm-x86/desc_64.h
White space and coding style clenaup. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/asm-x86/desc_64.h')
-rw-r--r--include/asm-x86/desc_64.h97
1 files changed, 52 insertions, 45 deletions
diff --git a/include/asm-x86/desc_64.h b/include/asm-x86/desc_64.h
index 7d9c938e69fd..bb2009ecbbca 100644
--- a/include/asm-x86/desc_64.h
+++ b/include/asm-x86/desc_64.h
@@ -1,4 +1,4 @@
1/* Written 2000 by Andi Kleen */ 1/* Written 2000 by Andi Kleen */
2#ifndef __ARCH_DESC_H 2#ifndef __ARCH_DESC_H
3#define __ARCH_DESC_H 3#define __ARCH_DESC_H
4 4
@@ -35,7 +35,7 @@ static inline unsigned long __store_tr(void)
35 * something other than this. 35 * something other than this.
36 */ 36 */
37extern struct desc_struct default_ldt[]; 37extern struct desc_struct default_ldt[];
38extern struct gate_struct idt_table[]; 38extern struct gate_struct idt_table[];
39extern struct desc_ptr cpu_gdt_descr[]; 39extern struct desc_ptr cpu_gdt_descr[];
40 40
41/* the cpu gdt accessor */ 41/* the cpu gdt accessor */
@@ -51,40 +51,45 @@ static inline void store_gdt(struct desc_ptr *ptr)
51 asm("sgdt %w0":"=m" (*ptr)); 51 asm("sgdt %w0":"=m" (*ptr));
52} 52}
53 53
54static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist) 54static inline void _set_gate(void *adr, unsigned type, unsigned long func,
55 unsigned dpl, unsigned ist)
55{ 56{
56 struct gate_struct s; 57 struct gate_struct s;
57 s.offset_low = PTR_LOW(func); 58
59 s.offset_low = PTR_LOW(func);
58 s.segment = __KERNEL_CS; 60 s.segment = __KERNEL_CS;
59 s.ist = ist; 61 s.ist = ist;
60 s.p = 1; 62 s.p = 1;
61 s.dpl = dpl; 63 s.dpl = dpl;
62 s.zero0 = 0; 64 s.zero0 = 0;
63 s.zero1 = 0; 65 s.zero1 = 0;
64 s.type = type; 66 s.type = type;
65 s.offset_middle = PTR_MIDDLE(func); 67 s.offset_middle = PTR_MIDDLE(func);
66 s.offset_high = PTR_HIGH(func); 68 s.offset_high = PTR_HIGH(func);
67 /* does not need to be atomic because it is only done once at setup time */ 69 /*
68 memcpy(adr, &s, 16); 70 * does not need to be atomic because it is only done once at
69} 71 * setup time
70 72 */
71static inline void set_intr_gate(int nr, void *func) 73 memcpy(adr, &s, 16);
72{ 74}
75
76static inline void set_intr_gate(int nr, void *func)
77{
73 BUG_ON((unsigned)nr > 0xFF); 78 BUG_ON((unsigned)nr > 0xFF);
74 _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 0, 0); 79 _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 0, 0);
75} 80}
76 81
77static inline void set_intr_gate_ist(int nr, void *func, unsigned ist) 82static inline void set_intr_gate_ist(int nr, void *func, unsigned ist)
78{ 83{
79 BUG_ON((unsigned)nr > 0xFF); 84 BUG_ON((unsigned)nr > 0xFF);
80 _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 0, ist); 85 _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 0, ist);
81} 86}
82 87
83static inline void set_system_gate(int nr, void *func) 88static inline void set_system_gate(int nr, void *func)
84{ 89{
85 BUG_ON((unsigned)nr > 0xFF); 90 BUG_ON((unsigned)nr > 0xFF);
86 _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, 0); 91 _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, 0);
87} 92}
88 93
89static inline void set_system_gate_ist(int nr, void *func, unsigned ist) 94static inline void set_system_gate_ist(int nr, void *func, unsigned ist)
90{ 95{
@@ -101,24 +106,25 @@ static inline void store_idt(struct desc_ptr *dtr)
101 asm("sidt %w0":"=m" (*dtr)); 106 asm("sidt %w0":"=m" (*dtr));
102} 107}
103 108
104static inline void set_tssldt_descriptor(void *ptr, unsigned long tss, unsigned type, 109static inline void set_tssldt_descriptor(void *ptr, unsigned long tss,
105 unsigned size) 110 unsigned type, unsigned size)
106{ 111{
107 struct ldttss_desc d; 112 struct ldttss_desc d;
108 memset(&d,0,sizeof(d)); 113
114 memset(&d, 0, sizeof(d));
109 d.limit0 = size & 0xFFFF; 115 d.limit0 = size & 0xFFFF;
110 d.base0 = PTR_LOW(tss); 116 d.base0 = PTR_LOW(tss);
111 d.base1 = PTR_MIDDLE(tss) & 0xFF; 117 d.base1 = PTR_MIDDLE(tss) & 0xFF;
112 d.type = type; 118 d.type = type;
113 d.p = 1; 119 d.p = 1;
114 d.limit1 = (size >> 16) & 0xF; 120 d.limit1 = (size >> 16) & 0xF;
115 d.base2 = (PTR_MIDDLE(tss) >> 8) & 0xFF; 121 d.base2 = (PTR_MIDDLE(tss) >> 8) & 0xFF;
116 d.base3 = PTR_HIGH(tss); 122 d.base3 = PTR_HIGH(tss);
117 memcpy(ptr, &d, 16); 123 memcpy(ptr, &d, 16);
118} 124}
119 125
120static inline void set_tss_desc(unsigned cpu, void *addr) 126static inline void set_tss_desc(unsigned cpu, void *addr)
121{ 127{
122 /* 128 /*
123 * sizeof(unsigned long) coming from an extra "long" at the end 129 * sizeof(unsigned long) coming from an extra "long" at the end
124 * of the iobitmap. See tss_struct definition in processor.h 130 * of the iobitmap. See tss_struct definition in processor.h
@@ -129,18 +135,18 @@ static inline void set_tss_desc(unsigned cpu, void *addr)
129 set_tssldt_descriptor(&cpu_gdt(cpu)[GDT_ENTRY_TSS], 135 set_tssldt_descriptor(&cpu_gdt(cpu)[GDT_ENTRY_TSS],
130 (unsigned long)addr, DESC_TSS, 136 (unsigned long)addr, DESC_TSS,
131 IO_BITMAP_OFFSET + IO_BITMAP_BYTES + sizeof(unsigned long) - 1); 137 IO_BITMAP_OFFSET + IO_BITMAP_BYTES + sizeof(unsigned long) - 1);
132} 138}
133 139
134static inline void set_ldt_desc(unsigned cpu, void *addr, int size) 140static inline void set_ldt_desc(unsigned cpu, void *addr, int size)
135{ 141{
136 set_tssldt_descriptor(&cpu_gdt(cpu)[GDT_ENTRY_LDT], (unsigned long)addr, 142 set_tssldt_descriptor(&cpu_gdt(cpu)[GDT_ENTRY_LDT], (unsigned long)addr,
137 DESC_LDT, size * 8 - 1); 143 DESC_LDT, size * 8 - 1);
138} 144}
139 145
140#define LDT_entry_a(info) \ 146#define LDT_entry_a(info) \
141 ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) 147 ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
142/* Don't allow setting of the lm bit. It is useless anyways because 148/* Don't allow setting of the lm bit. It is useless anyways because
143 64bit system calls require __USER_CS. */ 149 64bit system calls require __USER_CS. */
144#define LDT_entry_b(info) \ 150#define LDT_entry_b(info) \
145 (((info)->base_addr & 0xff000000) | \ 151 (((info)->base_addr & 0xff000000) | \
146 (((info)->base_addr & 0x00ff0000) >> 16) | \ 152 (((info)->base_addr & 0x00ff0000) >> 16) | \
@@ -172,12 +178,12 @@ static inline void load_TLS(struct thread_struct *t, unsigned int cpu)
172 178
173 for (i = 0; i < GDT_ENTRY_TLS_ENTRIES; i++) 179 for (i = 0; i < GDT_ENTRY_TLS_ENTRIES; i++)
174 gdt[i] = t->tls_array[i]; 180 gdt[i] = t->tls_array[i];
175} 181}
176 182
177/* 183/*
178 * load one particular LDT into the current CPU 184 * load one particular LDT into the current CPU
179 */ 185 */
180static inline void load_LDT_nolock (mm_context_t *pc, int cpu) 186static inline void load_LDT_nolock(mm_context_t *pc, int cpu)
181{ 187{
182 int count = pc->size; 188 int count = pc->size;
183 189
@@ -185,7 +191,7 @@ static inline void load_LDT_nolock (mm_context_t *pc, int cpu)
185 clear_LDT(); 191 clear_LDT();
186 return; 192 return;
187 } 193 }
188 194
189 set_ldt_desc(cpu, pc->ldt, count); 195 set_ldt_desc(cpu, pc->ldt, count);
190 load_LDT_desc(); 196 load_LDT_desc();
191} 197}
@@ -193,6 +199,7 @@ static inline void load_LDT_nolock (mm_context_t *pc, int cpu)
193static inline void load_LDT(mm_context_t *pc) 199static inline void load_LDT(mm_context_t *pc)
194{ 200{
195 int cpu = get_cpu(); 201 int cpu = get_cpu();
202
196 load_LDT_nolock(pc, cpu); 203 load_LDT_nolock(pc, cpu);
197 put_cpu(); 204 put_cpu();
198} 205}