Now that I am working om exception and interrupt handling, I am wondering how you guys are handling NMI's.
NMI's are caused by faulty hardware, in which case the best thing to do is hang the computer.
They are also used for performance monitoring and watchdogs, which are easily controlled by the OS.
However, when searching the net, I found that they are also used by some hardware. Do you take this into account?
What are your thoughts about this?
Non-maskable interrupts
Re: Non-maskable interrupts
I have a Dell Poweredge server with an NMI button. When you press it, it asserts the CPU's #NMI line and triggers an interrupt. At least in linux this causes a kernel panic and is used for debugging purposes/reset. I'd imagine most OS's handle it this way; a NMI is generally not recoverable.
Regards,
John.
Regards,
John.
-
- Member
- Posts: 1146
- Joined: Sat Mar 01, 2014 2:59 pm
Re: Non-maskable interrupts
Why would one want an NMI button on a server? Is it to halt the machine in case of viruses? In any case, it certainly sounds cool!
Perhaps I should wire a microswitch up to each CPU interrupt line for testing purposes... (Just kidding!)
Perhaps I should wire a microswitch up to each CPU interrupt line for testing purposes... (Just kidding!)
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.
Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Re: Non-maskable interrupts
As I said, normally for debugging purposes. A bit more reading reveals that it is used on Windows since 2000 (if a particular registry bit is set) to generate a crash dump on the system drive, useful when the system has become unresponsive.
Personally I use it to drop down into a gdb stub if kernel debug support is enabled, or panic if not. Of note, certain emulators (VirtualBox in debug mode at least) allow you to inject an NMI at run-time and so you can use this for investigating hangs in your own kernel.
Regards,
John.
Personally I use it to drop down into a gdb stub if kernel debug support is enabled, or panic if not. Of note, certain emulators (VirtualBox in debug mode at least) allow you to inject an NMI at run-time and so you can use this for investigating hangs in your own kernel.
Regards,
John.
Re: Non-maskable interrupts
While searching the net, I found someone who had a foot pedal attached to the NMI line.
Anyway, my problem is when ordinary hardware (like a sound card) is sending NMI's to the CPU. How do you distinguish those from other causes, if you do so at all?
Anyway, my problem is when ordinary hardware (like a sound card) is sending NMI's to the CPU. How do you distinguish those from other causes, if you do so at all?
-
- Member
- Posts: 5512
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Non-maskable interrupts
You don't. (Unless you've set up the watchdog timer.)
If you receive a NMI (and it's not the watchdog), it means your OS should not be running anymore. Either the hardware failed, or the user pressed the "make it crash" foot pedal.
For the sake of completeness, I will mention that really old PCs have the 8087 attached to NMI. However, if you're writing your OS for something that old, you should already know that.
If you receive a NMI (and it's not the watchdog), it means your OS should not be running anymore. Either the hardware failed, or the user pressed the "make it crash" foot pedal.
For the sake of completeness, I will mention that really old PCs have the 8087 attached to NMI. However, if you're writing your OS for something that old, you should already know that.