APIC timer interrupter problem
Posted: Tue Jun 08, 2010 6:46 am
Please help me.I have met something odd when I enable APIC timer.once I set IF flag,it always comes with GP error.I checked my CPL & DPL out ,CPL=0,DPL=0.But if I use 8259A timers,it's OK. No GP error any more.
Code: Select all
global G_IRQ_ENTRIES_START
extern G_Do_IRQ
extern _USER_DATA
extern _GDT_NULL
extern G_Enable_8259A_IRQ
%define NR_IRQS 224
%macro G_SAVE_ALL 0
cld
push es
push ds
push eax
push ebp
push edi
push esi
push edx
push ecx
push ebx
mov edx,_USER_DATA
sub edx,_GDT_NULL
mov ds,dx
mov es,dx
%endmacro
%macro G_RESTORE_INT_REG 0
pop ebx
pop ecx
pop edx
pop esi
pop edi
pop ebp
pop eax
%endmacro
%macro G_RESTORE_REG 0
G_RESTORE_INT_REG
pop ds
pop es
%endmacro
;;;interrupt
G_IRQ_ENTRIES_START:
[BITS 32]
%assign vec 0
%rep NR_IRQS
ALIGN 16
push vec-256
jmp G_Common_Interrupt
%assign vec vec+1
%endrep
ALIGN 16
;;;Common Interrupt
G_Common_Interrupt:
G_SAVE_ALL;it is same with SAVE ALL macro of Linux
mov eax,esp
call G_Do_IRQ;G_Do_IRQ function is similar to Linux's _do_irq
jmp G_Ret_From_Inter
;;;Ret From Inter
G_Ret_From_Inter:
cli
mov al,0
out 0x21,al
G_RESTORE_ALL:
pop ebx
pop ecx
pop edx
pop esi
pop edi
pop ebp
pop eax
add esp,12
iretd