开发者

How to create an IDT using LIDT I work on Intel-Atom 32bits (Assembly AT&T)

How to create an IDT using LIDT I work on Intel-Atom 32bits (Assembly AT&T). I am using the MocroC OSII as an OS, i did this but it doesn,t work:

    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;
    *(Interrup开发者_Python百科t_Address+1) = (base>>16)&0xFFFF;

}


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


Resolved :), as there is a BIOS, it already built the GDT/IDT.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜