Subject: Re: kernel stack overflow on netbsd-1-6 branch
To: David Laight <david@l8s.co.uk>
From: Frank van der Linden <fvdl@wasabisystems.com>
List: port-i386
Date: 11/26/2002 16:08:41
On Tue, Nov 26, 2002 at 02:37:30PM +0000, David Laight wrote:
> Is the kernel stack still mapped with the U area?
> If not you waste the rest of the U area page unless the U area
> is mapped to the top of the area - which I don't think it is.

Correct, you waste PAGE_SIZE - USPACE bytes. Not a big deal, but
I added the NOREDZONE option for small-memory systems to avoid this.

> I did wonder whether it was possible to map a single physical page
> into the last page of kernel stack for every process.
> This could be used by interrupts and (possibly) by deep call
> sequences.  However you would panic on any attempt to sleep
> with the sp in that page (and maybe any non-nested ISR).
> 
> Do we stack switch for ISRs anyway? I could grep for it...

i386 does not switch stacks for ISRs. The only way to switch
stacks on a trap or interrupt is to use a TSS gate, and they
are more expensive than normal trap gates. I only set up
the double fault handler with a TSS gate, since it's fatal
anyway, enabling it to switch stacks and have DDB make sense
of it all.

- Frank

-- 
Frank van der Linden                                    fvdl@wasabisystems.com
==============================================================================
Quality NetBSD Development, Support & Service.   http://www.wasabisystems.com/