Li-Ta Lo ollie@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
* Eric W. Biederman ebiederman@lnxi.com [041103 00:26]:
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
What would btw be the correct way of resuming operation after, say, a division by zero exception? I tried to set a new info->eip in x86_exception() to a helper function, but I get the honour of a GPF right after returning from that function... finding it jumps into the stack at some point.
Stefan