It is useful for this command to show the address of the interrupt table.
Add support for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
u16 base_high;
} __packed;
-struct desc_ptr {
- unsigned short size;
- unsigned long address;
-} __packed;
-
struct idt_entry idt[256] __aligned(16);
-struct desc_ptr idt_ptr;
+struct idt_ptr idt_ptr;
-static inline void load_idt(const struct desc_ptr *dtr)
+static inline void load_idt(const struct idt_ptr *dtr)
{
asm volatile("cs lidt %0" : : "m" (*dtr));
}
return 0;
}
+void interrupt_read_idt(struct idt_ptr *ptr)
+{
+ asm volatile("sidt %0" : : "m" (*ptr));
+}
+
void *x86_get_idt(void)
{
return &idt_ptr;
EXC_VE
};
+/**
+ * struct idt_ptr - Holds the IDT (Interrupt Descriptor Table)
+ *
+ * @size: Size of IDT in bytes
+ */
+struct idt_ptr {
+ unsigned short size;
+ unsigned long address;
+} __packed;
+
/* arch/x86/cpu/interrupts.c */
void set_vector(u8 intnum, void *routine);
void *x86_get_idt(void);
+/**
+ * interrupt_read_idt() - Read the IDT
+ *
+ * @ptr: Place to put IDT contents
+ */
+void interrupt_read_idt(struct idt_ptr *ptr);
+
#endif
int do_irqinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
#if !CONFIG_IS_ENABLED(X86_64)
+ struct idt_ptr ptr;
int irq;
+ interrupt_read_idt(&ptr);
+ printf("IDT at %lx, size %x\n", ptr.address, ptr.size);
printf("Spurious IRQ: %u, last unknown IRQ: %d\n",
spurious_irq_cnt, spurious_irq);