PIT problems

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
User avatar
intel_breaker
Member
Member
Posts: 46
Joined: Tue Jan 04, 2005 12:00 am
Location: Poland
Contact:

PIT problems

Post by intel_breaker »

Hi, I have problem with PIT (8254 chipset).
If i add: for(i = 0; i < 99999; i++) to the irq0 handler, After few seconds, computer is restarting,
If I don't add this loop all is ok - scheduler works, etc..
But if I put function that executes longer than standard scheduler (example long loop) computer frezzed or restarting or screen is clearing (memory errors - i think).
Timer is sets on 100HZ.
<----------------
This look that:

PIT tick 0*******->*****PIT tick 1****->*****PIT tick 2...

**********|Function1|************|Function2 with loooop|


First function fit between two next pit ticks, but second functin don't fit and occured computer restart
(I've disabled irqs)
Last edited by intel_breaker on Fri Jul 22, 2005 11:00 pm, edited 1 time in total.
User avatar
prajwal
Member
Member
Posts: 154
Joined: Sat Oct 23, 2004 11:00 pm
Contact:

Re: PIT problems

Post by prajwal »

have u put PUSHA instruction at the beginning of Int Handler
and corresponding POPA at the end of Int Handler (Before leave; iret)

These Intstuctions push all General purpose registers to stack and
pop them back.....


If u r pushing even Segment Registers (ex PUSH FS), then doing
a pop fs at end, then make sure that the Seg Reg contains a valid
Selector (Assuming, u r in PM). since on every pop to a Seg Reg, the
processor validates it (looks into GDT/LDT for the corresponding Selector) and throughs Exception if not valid
Osbios
Member
Member
Posts: 116
Joined: Fri Jun 10, 2005 11:00 pm

Re: PIT problems

Post by Osbios »

OK, first question: Why --> for(i = 0; i < 99999; i++)
NEVER write big IRQ handlers and collect IRQs from a device!!! That?s not possible!
Especial not for the PIT!!! :]

The Probblem is that the PIC can?t store IRQs from the same device. If the IRQ handler still working and a new IRQ(from the same device) is activated then you got a problem.
dw 0xAA55
User avatar
intel_breaker
Member
Member
Posts: 46
Joined: Tue Jan 04, 2005 12:00 am
Location: Poland
Contact:

Re: PIT problems

Post by intel_breaker »

Yeah, thnx for help anyway. I didn't now about it, I put big loop into the handler's code for tests (I didn't know that it will occure failure).
Is there any way to omit this problem?
User avatar
intel_breaker
Member
Member
Posts: 46
Joined: Tue Jan 04, 2005 12:00 am
Location: Poland
Contact:

Re: PIT problems

Post by intel_breaker »

to srinivasa_prajwal:
Yes, i have pusha & popa intructions. My kernel is more advanced than you think (meabe?)
Legend
Member
Member
Posts: 195
Joined: Tue Nov 02, 2004 12:00 am
Contact:

Re: PIT problems

Post by Legend »

Hmm, there might be a way to reduce the effect of the problem,
by defering the heavy work, which means you jump to the isr, somehow take note that it happended, iret, and then the real handler code runs.
But if your handler code takes longer then one pit interval you'll still be screwed.
*post*
Post Reply