dpotop
Posts: 78
Joined: Mon Nov 24, 2014 2:14 pm

IRQ received while in SWI handler

Thu Nov 27, 2014 1:53 pm

Hello,

I'm writing a simple multi-tasking scheduler (a small OS, if you want).
Currently, execution is purely time-triggered, so I only handle the
IRQ interrupt. The handler only enables interrupts just before entering
user mode and giving control to the interrupted task.

However, I want to have system services and therefore I need to
handle SWI interrupts. The question that arises is: What happens
when the timer interrupt comes during the execution of the SWI
handler? Do I have to read the interrupt status flags and start
the IRQ handler code myself after enabling interrupts ?

Any help would be appreciated,
Dumitru
dpotop

dwelch67
Posts: 961
Joined: Sat May 26, 2012 5:32 pm

Re: IRQ received while in SWI handler

Thu Nov 27, 2014 3:13 pm

How about just try it? Set up an experiment and see what happens. Pretty easy to setup an swi that just spins in a loop, then have the interrupt handler change something global that the swi handler can see.

I would assume the desired implementation for the hardware would have been to have interrupts interrupt the swi handler and not the other way around, but would have to just do an experiment both ways to find out (another experiment, from an irq call an swi).

David

dpotop
Posts: 78
Joined: Mon Nov 24, 2014 2:14 pm

Re: IRQ received while in SWI handler

Thu Nov 27, 2014 4:25 pm

dwelch67 wrote:How about just try it? Set up an experiment and see what happens. Pretty easy to setup an swi that just spins in a loop, then have the interrupt handler change something global that the swi handler can see.
Ok, that's good advice, thanks (even though I would have preferred having an explanation of what happens.
dwelch67 wrote:I would assume the desired implementation for the hardware would have been to have interrupts interrupt the swi handler and not the other way around, but would have to just do an experiment both ways to find out (another experiment, from an irq call an swi).
Well, doing it the other way would be useless, because in my system nobody can generate an SWI from the IRQ handler.

Yours,
Dumitru
dpotop

Return to “Bare metal, Assembly language”