Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Dec 2001 14:24:35 +0000 (GMT)
From:      Doug Rabson <dfr@nlsystems.com>
To:        Julian Elischer <julian@elischer.org>
Cc:        Poul-Henning Kamp <phk@critter.freebsd.dk>, John Baldwin <jhb@FreeBSD.org>, <arch@FreeBSD.org>, Alfred Perlstein <bright@mu.org>
Subject:   Re: Kernel stack size and stacking: do we have a problem ? 
Message-ID:  <20011223142258.V457-100000@salmon.nlsystems.com>
In-Reply-To: <Pine.BSF.4.21.0112201412310.46573-100000@InterJet.elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 20 Dec 2001, Julian Elischer wrote:

>
>
> On Thu, 20 Dec 2001, Poul-Henning Kamp wrote:
>
> >
> > A) We should probably implement
> > 	int enough_stack()
>
> a full unoptimised but correct version would be:
>
> int
> enough_stack(u_int needed)
> {
> 	caddr_t addr, addr2;
>
> 	if needed > KSTACK_PAGES * PAGESIZE return 0;
>
> 	/* catch stupid values */
> 	addr1 = &needed;
> 	addr2 = (caddr_t)curthread->td_kstack + needed;
>
> 	return (addr1 > addr2)
> }

One thing to remember - ia64 has *two* stacks. One traditional stack grows
from the top of the kstack region downwards and the other, the register
stack, grows upwards from the base of the kstack region. Its not possible
to have a truly MI implementation of enough_stack().

-- 
Doug Rabson				Mail:  dfr@nlsystems.com
					Phone: +44 20 8348 6160



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011223142258.V457-100000>