x86/idt: Make IDT init functions static inlines
[linux-2.6-microblaze.git] / arch / x86 / include / asm / desc.h
index 1ced11d..476082a 100644 (file)
@@ -383,6 +383,33 @@ static inline void set_desc_limit(struct desc_struct *desc, unsigned long limit)
 
 void alloc_intr_gate(unsigned int n, const void *addr);
 
+static inline void init_idt_data(struct idt_data *data, unsigned int n,
+                                const void *addr)
+{
+       BUG_ON(n > 0xFF);
+
+       memset(data, 0, sizeof(*data));
+       data->vector    = n;
+       data->addr      = addr;
+       data->segment   = __KERNEL_CS;
+       data->bits.type = GATE_INTERRUPT;
+       data->bits.p    = 1;
+}
+
+static inline void idt_init_desc(gate_desc *gate, const struct idt_data *d)
+{
+       unsigned long addr = (unsigned long) d->addr;
+
+       gate->offset_low        = (u16) addr;
+       gate->segment           = (u16) d->segment;
+       gate->bits              = d->bits;
+       gate->offset_middle     = (u16) (addr >> 16);
+#ifdef CONFIG_X86_64
+       gate->offset_high       = (u32) (addr >> 32);
+       gate->reserved          = 0;
+#endif
+}
+
 extern unsigned long system_vectors[];
 
 extern void load_current_idt(void);