Linux-kernel mailing list archive 2000-23,: Re: Why reassert ix86 NMI?

# Re: Why reassert ix86 NMI?

Richard B. Johnson (root@chaos.analogic.com)
Tue, 6 Jun 2000 13:34:00 -0400 (EDT)

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Urban Widmark: "Re: via-rhine: NETDEV WATCHDOG: eth0: transmit timed out"
- Previous message: Jes Sorensen: "Re: (reiserfs) Re: New Linux 2.5 - 2.6 TODO (Alan Cox suggestsdelaying"

On Tue, 6 Jun 2000, Maciej W. Rozycki wrote:

> On Tue, 6 Jun 2000, Richard B. Johnson wrote:
>
> > The reads (marked dummy) of the CMOS data port don't do anything useful
> > because there is already a long delay caused by the two index selections.
>
> Just a safeguard for old i386s and similar crap.
>
> > Leaving the CMOS index at 0x0f (the shutdown-byte offset) is not a
> > really good idea. A power-failure can (read will) corrupt the byte
> > at which the index is pointing. The result may be that upon subsequent
> > boot, you may have to manually boot because the BIOS can get confused if
> > the shutdown byte was any of the 'return-from-protected' mode bytes and it
> > wasn't really what happened.
>
> That's not a problem as BIOSes ask the 8042 keyboard controller (bit #2
> of the status register; also in the command byte) whether it is a poweron
> or cold reset startup or just a reboot. If it's the former, the shutdown
> type is not checked at all and a normal POST procedure happens.

Not correct. If you send a bad descriptor to INT 0x15, function 0x87,
the processor will reset (crash). The shutdown-byte is checked early
during POST. If it was 0x09, the code will load the old stack-pointer
from 40:[67] and stack-segment from 40:[69], restore all registers
from the stack, set the carry flag, signaling the error, put an error-
code into AX, then issue a far return with a pop-value of 2 (to remove
old flags).

This will return an error to the program that was executing the bad
block-move. This sequence is directly from the published PC/AT BIOS.

Now, imagine what happens if the machine was just started from a
cold-boot and 0x09 was found in the CMOS shutdown byte. This will
result in a crash requiring an on-site reset. The reset will work,
because POST will have changed the shutdown byte to 0 before it
did the '0x09 thing'. However, you need to physically be there.

>
> That would be dangerous as an NMI can happen in the middle of an RTC
> memory access sequence.

That is the purpose of the sequence. It is hardly dangerous. Its
specific purpose is to cause another NMI if the latch is still set.

> Corrupting the shutdown type is harmless, on the
> other hand.

Not harmless as shown.

> Well, corrupting seconds is not a disaster, either, but the
> clock may be used by the userland for some purpose.
>

You could have the time be off by a maximum of 59 seconds. Since
it's BCD, there is an additional probability consideration since
the registers will mask (not wrap) to '99', which is '99' - '59' ='40'
so with all bits set on a crash, it's most likely that the time will
be off by 40 seconds.

Cheers,
Dick Johnson

Penguin : Linux version 2.3.41 on an i686 machine (800.63 BogoMips).

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

- Next message: Urban Widmark: "Re: via-rhine: NETDEV WATCHDOG: eth0: transmit timed out"
- Previous message: Jes Sorensen: "Re: (reiserfs) Re: New Linux 2.5 - 2.6 TODO (Alan Cox suggestsdelaying"