Skip to contentSkip to conversation

What reassert_nmi() in default_do_nmi() is for?

DISCUSSION Huang Ying 1 participant 1 message Aug 30, 2010

lore
Share & tools
lore

Huang Ying

author
#0 lore raw

Hi, All,

When reading NMI handler code, I find there is reassert_nmi() in the end of default_do_nmi(). And it is only called if the reason & 0xc0 != 0 (reason = inb(0x61)).

The comments for it is as follow:

	/*
	 * Reassert NMI in case it became active meanwhile
	 * as it's edge-triggered:
	 */
	reassert_nmi();

The implementation of reassert_nmi is as follow:

static inline void reassert_nmi(void)

{
        int old_reg = -1;

        if (do_i_have_lock_cmos())
                old_reg = current_lock_cmos_reg();
        else
                lock_cmos(0); /* register doesn't matter here */
        outb(0x8f, 0x70);
        inb(0x71);              /* dummy */
        outb(0x0f, 0x70);
        inb(0x71);              /* dummy */
        if (old_reg >= 0)
                outb(old_reg, 0x70);
        else
                unlock_cmos();
}

I can not understand the code and the logic. Can anyone explain it in more detail?

Thanks,
Huang Ying