Page 1 of 1

#GP after big interrupt pause

Posted: Tue Apr 14, 2009 2:37 am
by rezoimnadze
When client calls sysenter procedure, and when we stop interrupts for a big time, after sti instruction General Protection Fault occures.

I think processor wants to make System Timer interrupt and something wrong happens.

How can I debug this incident? what is the reason?
---
Not onley in sysenter procedure. everyware I put this code:

Code: Select all

	cli
	mov ecx, 0x100000
.Loop:
	loop .Loop
	sti
	mov eax, 0
	mov eax, 0
	mov eax, 0               ; System Timer Interrupt. Everything is well.
	mov eax, 0
	mov eax, 0

	cli
	mov ecx, 0x100000
.Loop1:
	loop .Loop1
	sti
	mov eax, 0
	mov eax, 0
	mov eax, 0                 ; #GP
	mov eax, 0
	mov eax, 0
In this case:

Code: Select all

	cli
	mov ecx, 0x1000000  ; I extend loop size.
.Loop:
	loop .Loop
	sti
	mov eax, 0
	mov eax, 0                 ; #GP
	mov eax, 0
	mov eax, 0
	mov eax, 0

Re: #GP after big interrupt pause

Posted: Tue Apr 14, 2009 6:08 am
by Archil
Is your timer still running while that GPF?

Re: #GP after big interrupt pause

Posted: Tue Apr 14, 2009 7:33 am
by rezoimnadze
No, GPF ISR ends with "jmp $".

Re: #GP after big interrupt pause

Posted: Tue Apr 14, 2009 8:45 am
by Troy Martin
So yes, the timer still runs. JMP $ doesn't stop interrupts, you need CLI and HLT to do that.

The x86 is a well-documented beast, read the manuals. They help.

Re: #GP after big interrupt pause

Posted: Tue Apr 14, 2009 11:19 pm
by rezoimnadze
Troy Martin wrote:So yes, the timer still runs. JMP $ doesn't stop interrupts, you need CLI and HLT to do that.

The x86 is a well-documented beast, read the manuals. They help.
I Know, but in interrupt handler (#GP Handler) Interrupt Flag is not set.

I solved this problem by disabling and enabling System Timer and others in PIC, while a pig interrupt pause.

Thank you.

Code: Select all

push ax
                cli

	push ax
	mov ax,0b1111111111111111
	out PIC.Data.Port.MasterData,al
	mov al,ah
	out PIC.Data.Port.SlaveData,al
	pop ax

                ; Large code here.

	mov ax,0b1111111111111100
	out PIC.Data.Port.MasterData,al
	mov al,ah
	out PIC.Data.Port.SlaveData,al
	pop ax

	sti

Re: #GP after big interrupt pause

Posted: Wed Apr 15, 2009 12:21 pm
by earlz
could be possible your timer interrupt is buggy.. it could really be almost anywhere.. you did remap the PIC right?

Re: #GP after big interrupt pause

Posted: Sat Jul 25, 2009 8:19 am
by rezoimnadze
could be possible your timer interrupt is buggy..
Yes, this was. Thank you.
There ware some other "little" problems too. :)