Interrupt Handling

Eric W. Biederman ebiederman at lnxi.com
Tue Nov 2 17:03:00 CET 2004


Li-Ta Lo <ollie at lanl.gov> writes:

> Eric,
> 
> Why there are two ways for interrupt handling in c_start.S

There are two ways for hardware exception handling.  Interrupts
are not handled.  And that is because on x86 exception handlers
don't always give you an error code.
 
> vec9:
>         pushl   $0 /* error code */
>         pushl   $9 /* vector */
>         jmp int_hand
>                                                                                                                                                
> 
> vec10:
>         /* error code */
>         pushl   $10 /* vector */
>         jmp     int_hand
>         .word   0x9090
> 
> Vector 9 push the error code and vector but vector 10 only push the 
> vector number.
> 
> BTW, are those handler actually used ? The idt is uninited.

This hunk below initializes it.  It seems to work out better to initialize the idt
with code instead of data.

       /* Initialize the Interrupt Descriptor table */
        leal    _idt, %edi
        leal    vec0, %ebx
        movl    $(0x10 << 16), %eax     /* cs selector */

1:      movw    %bx, %ax
        movl    %ebx, %edx
        movw    $0x8E00, %dx            /* Interrupt gate - dpl=0, present */
        movl    %eax, 0(%edi)
        movl    %edx, 4(%edi)
        addl    $6, %ebx
        addl    $8, %edi
        cmpl    $_idt_end, %edi
        jne     1b

        /* Load the Interrupt descriptor table */
        lidt    idtarg

Eric




More information about the coreboot mailing list