SM> *** Glen McNabb wrote in a message to Scott McNay:
SM> SM> SM> SM> On the 808x, when loading SS, an interrupt can occur before
SM> SP is
SM> SM> SM> loaded,
SM> SM> SM> GM> Reliably, a well written interrupt will not use the current
SM> SM> SM> GM> stack for that reason.
SM>
SM> SM> SM> You must be talking about something else... it sounds like
SM> GM> Not really, it's just that the location of the stack is
SM> GM> undefined.
SM> Yes? And when the interrupt returns, it'll put the stack back the way it
SM> found it. It BETTER be defined, or else the system is gonna crash
yway.
SM> Oops, now I see your point... but since it only occurs on the 8088/8086
SM> which is rarely seen nowadays, and programmers at the time knew to
SM> disable interrupts before a stack change, I don''t see this as a
SM> significant problem except possibly with the NMI handler.
Actually, (and I checked) it can happen on all of them. Changing the
the location of the stack (to a different segment) involves changing
the SS and the SP. (usually) If the interupt occurs between loading
those two registers the stack's location is undefined for that period
of time.
In the case of the NMI, it's used for parity checking. The NMI should
never activate unless you have a parity error. If you have a failed
parity, a stack is gonna be the least of your problems.
SM> GM> One method of determining "enough" stack space is to
SM> GM> allocate stack space as db 100 dup "STACK" (make it
SM> GM> oversized). Then run the program through debug. When it's
SM> GM> done, then do dump of the whole stack space and see how much
SM> GM> is used during run-time. (how much STACK is overwritten)
SM> GM> This can give you a rough idea of how much stack space is
SM> GM> used...
SM> You also need a specific amount for interrupts. But, granted, an
SM> interrupt shouldn't assume that there's enugh if it uses the stack
SM> heavily.
This method will show the amount used under normal conditions including
interupts. Otherwise, I agree...
SM> SM> Of course, I could just ASSUME a PC-compatible board, and disable
I.
SM> GM> You can't disable the NMI. It's hardwired to the parity
SM> GM> check. The port to disable the parity on motherboards vary
Like I said, the NMI should never activate....
Glen...
--- ProBoard v2.16 [Reg]
---------------
* Origin: NC/NEC SEWAnet, Bucolic Fair (1:3407/25)
|