Ticket #424 (Open)Fri Apr 22 12:55:26 UTC 2016

Issuing OS_Byte 19 from an IRQ handler is dangerous

Reported by:

Jeffrey Lee (213)

Severity:

Normal

Part:

RISC OS: General

Release:

Milestone:

Status

Open

Details by Jeffrey Lee (213):

If a GraphicsV driver is relying on RTSupport to generate VSync events, issuing OS_Byte 19 from an IRQ handler will deadlock the machine due to IRQ handlers having higher priority than RTSupport threads.

It’s also possible this could deadlock standard IRQ-based GraphicsV drivers, if e.g. the driver masks its interrupt, enables interrupts in the PSR, and is then pre-empted by another IRQ handler before it’s able to issue the VSync event.

Suggested fix is to make OS_Byte 19 return immediately if called from an IRQ context (doing blocking operations from IRQ is bad form anyway). Any code which actually needs VSync synchronisation (e.g. Hourglass module) can be changed to e.g. listen for the VSync event from EventV instead.