#GP after big interrupt pause

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
rezoimnadze
Posts: 8
Joined: Tue Apr 14, 2009 2:14 am

#GP after big interrupt pause

Post 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
Archil
Posts: 24
Joined: Tue Jul 15, 2008 7:54 am
Location: Tbilisi, Georgia.
Contact:

Re: #GP after big interrupt pause

Post by Archil »

Is your timer still running while that GPF?
rezoimnadze
Posts: 8
Joined: Tue Apr 14, 2009 2:14 am

Re: #GP after big interrupt pause

Post by rezoimnadze »

No, GPF ISR ends with "jmp $".
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: #GP after big interrupt pause

Post 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.
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
rezoimnadze
Posts: 8
Joined: Tue Apr 14, 2009 2:14 am

Re: #GP after big interrupt pause

Post 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
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Re: #GP after big interrupt pause

Post by earlz »

could be possible your timer interrupt is buggy.. it could really be almost anywhere.. you did remap the PIC right?
rezoimnadze
Posts: 8
Joined: Tue Apr 14, 2009 2:14 am

Re: #GP after big interrupt pause

Post by rezoimnadze »

could be possible your timer interrupt is buggy..
Yes, this was. Thank you.
There ware some other "little" problems too. :)
Post Reply