Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title Attaching a handler to the NMI(Non Maskable Interrupt)
Ref. No. QNX.000007208
Category(ies) Kernel, Development
Issue Our present hardware has some logic connected to the NMI line on the Pentium. In the past, our software developers have found that:
a) there is no library call to attach an ISR to the NMI; and
b) the NMI ISR did not function without some unexplainable side effects.

Do you have any notes which may provide a solution to the problems we encountered previously?



Solution QNX4 does not support trapping of NMI. QNX4.23 and beyond are 'nmi' safe; however handling it isn't trivial.  Basically, you get a raw vector and 3 words of stack space, and you will have to stuff the vector yourself and point at your handler.  You cannot trigger proxies or invoke any kernel calls, and if you allow nmi's to nest, your toast.

One needs to be VERY careful when processing NMI interrupts since they are (by definition) non-maskable, and can (and will) occur at inconvenient times... for instance during kernel critical sections where the ldt:ss:sp are being manipulated. Since they can't be masked, interrupts at such times could cause considerable damage. QNX4 has a "safe" handler for NMI to prevent such damage, but that there is no way to propegate this event to an application.

There's an NMI example in /usr/free/qnx4/os/samples/misc/nmi_example.tar. In earlier versions, the OS did not handle the nmi, and subsequently caused a crash. In 4.24 the OS catches the nmi to prevent a crash.

NOTE: An NMI will set a SIGBUS on the process which is executing.  If it hits in the kernel the system will dump its registers and halt.