[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] CPU hogs, continued



> What kind of program would that be? The following piece of code indicates
> that the 200Hz timer works as it should:

Hm. The decision whether to run the scheduling code or to skip it is 
made according to the information stacked by the CPU when the interrupt 
occurs. The code looks into the stackframe and decides, whether it is 
allowed to preempt. The preemption is forbidden in two cases:

1) when the interrupt occurs in supervisor mode (i.e. bit 13 of the 
   stacked SR is on).

2) when the interrupt occurs while the IPL is higher than 3 (IPL is 
   encoded in bits 8-10 of the stacked SR).

That last is being made because the timer C has quite high priority (6 
IIRC), so before the scheduler is executed, the IPL is lowered to 3, so 
that the execution couldn't block other interrupts, especially timer C 
itself, interrupts associated with RS-232 ports etc. However, when the 
stacked IPL is higher than 3, the scheduling code is skipped - 
assumption is made that the timer C just aborted execution of another 
interrupt, with higher priority.

I can imagine, that if timer C is emulated on Milan, the saved IPL may 
be rather high (because it is the priority of the interrupt which 
emulates timer C, not "real" one).

You would have to check, what value the stacked SR has, when the 
interrupt occurs. The SR is the word on the top of the stackframe.

CVV

--
Konrad M.Kokoszkiewicz
draco@atari.org                             http://draco.atari.org

* Ea natura multitudinis est:  *  Taka to juz natura pospolstwa: *
* aut seruit humiliter,        *    albo sluzalczo sie plaszczy, *
* aut superbe dominatur.       *        albo bezczelnie panoszy. *
                     (T. Liuius XXIV, 25)