使用IDT(INTERRUPT DESCRIPTOR TABLE)组件AT& T intel 32位

时间:2011-10-21 18:30:19

标签: assembly x86

我正在研究N450主板,我发现它已经有了IDT(也许是由BIOS构建的!!)。 当我使用INT $ 0x55(使用ItnCall)调用我的ISR时,代码跳转到另一个随机地址而不是跳转到ISR_0x55 !!!,为什么?

这是我的代码:

C代码

    fill_interrupt(ISR_0x55,
                (unsigned int) isr0x55, //
                0x10,                 // Segment Selector
                0x8E);                // P=1, DPL=0, D=1

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+2) = (flags<<8)&0xFF00;
    *(Interrupt_Address+3) = (base>>16)&0xFFFF;

}

汇编代码

IntCall:

    push %ebp   //save the context to swith back
    movl %esp,%ebp
//debug only
    nop
    nop
//debug only

    int $0x55
    pop %ebp //Return to the calling function
    ret

1 个答案:

答案 0 :(得分:0)

已解决:),只是一个断点,我在ISR里面放了一个断点,调试器不喜欢它