Page 1 of 1
[solved] How to enable NMI
Posted: Mon Aug 04, 2008 8:52 am
by deste
Hi,
I am currently coding task management for my OS, and am unable to activate the NMI. I tried the method described in the wiki, but without success (there is nothing that happens).
Can you tell me how to activate the NMI, knowing that this doesn't work :
Code: Select all
void NMI_enable(void)
{
outb(0x70, inb(0x70)&0x7F);
inb(0x71);
}
Thanks in advance.
Re: How to enable NMI
Posted: Mon Aug 04, 2008 11:50 am
by jal
deste wrote:I am currently coding task management for my OS, and am unable to activate the NMI. I tried the method described in the wiki, but without success (there is nothing that happens).
That is exactly what should happen - nothing. The NMI is only triggered in rare cases, like hardware failure (although I'm not even sure it's hooked up at all on a modern PC).
JAL
Re: How to enable NMI
Posted: Mon Aug 04, 2008 1:10 pm
by deste
Hi,
The NMI is used for preemptive multi-task, isn't it ?
I'd like to know how to get a NMI at a regular interval, in order to switch thread.
Can I use the interruption of the clock (IRQ 0) for that ?
Re: How to enable NMI
Posted: Mon Aug 04, 2008 2:19 pm
by Combuster
Under normal circumstances, you should not get an NMI, just use IRQ0 instead. If you do that kind of things in NMIs you can no longer disable interrupts for anything anymore, so you must be ready to get interrupted at all times, which is probably not what you want.
And if you have multiple sources of an NMI (which you would already have by making the clock an NMI - was it a tick or a system crash?), you can no longer tell what caused it, whereas a regular interrupt is distinguished by interrupt number.
The only way I can think of to get clock NMIs is by doing something with the IOAPIC (of which a) I don't know if it can actually do that, and b) the IOAPIC is not present on all computers, especially not older ones)
Re: How to enable NMI
Posted: Tue Aug 05, 2008 2:26 am
by deste
Hi,
I will eventually use the IRQ0, which will allow me to hide interruptions with a CLI.
Thanks again for your help.