如何使用LIDT创建IDT我在Intel-Atom 32bits(Assembly AT& T)上工作

时间:2011-09-29 21:36:21

标签: assembly x86

如何使用LIDT创建IDT 我在Intel-Atom 32bits(Assembly AT& T)上工作。 我使用MocroC OSII作为操作系统, 我做了这个,但它不起作用:

    Load_IDT:
push    %ebp    //save the context to swith back
mov     %esp,%ebp

movw    $256*8, -6(%esp) //256 ISR possible
movl    $IDT, -4(%esp)   //IDT is a table of 256*8bytes
lidt    -6(%esp)

pop     %ebp //Return to the calling function
ret



    static void fill_interrupt(unsigned char num, unsigned int base, unsigned short sel, unsigned char flags)
{
    unsigned short *Interrupt_Address;

    /*address = idt_ptr.base + num * 8 byte*/
    Interrupt_Address = (unsigned short *)(idt_ptr.base + num*8);

    *(Interrupt_Address) = base&0xFFFF;
    *(Interrupt_Address+1) = sel;
    *(Interrupt_Address+1) = (flags>>4)&0xFF00;
    *(Interrupt_Address+1) = (base>>16)&0xFFFF;

}


/*Change the address of idt_entries table */
fill_interrupt(ISR_Nbr,(unsigned int) isr33, 0x08, 0x8E);

1 个答案:

答案 0 :(得分:0)

已解决:),因为有BIOS,它已经构建了GDT / IDT。