From owner-freebsd-hackers Mon Dec 7 08:28:48 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id IAA14613 for freebsd-hackers-outgoing; Mon, 7 Dec 1998 08:28:48 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from spinner.netplex.com.au (spinner.netplex.com.au [202.12.86.3]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id IAA14605 for ; Mon, 7 Dec 1998 08:28:44 -0800 (PST) (envelope-from peter@netplex.com.au) Received: from spinner.netplex.com.au (localhost [127.0.0.1]) by spinner.netplex.com.au (8.9.1/8.9.1/Netplex) with ESMTP id AAA19880; Tue, 8 Dec 1998 00:28:15 +0800 (WST) (envelope-from peter@spinner.netplex.com.au) Message-Id: <199812071628.AAA19880@spinner.netplex.com.au> X-Mailer: exmh version 2.0.2 2/24/98 To: Doug Rabson cc: zhihuizhang , hackers Subject: Re: Definition of kstack and PTDpde in locore.s In-reply-to: Your message of "Mon, 07 Dec 1998 10:07:51 GMT." Date: Tue, 08 Dec 1998 00:28:11 +0800 From: Peter Wemm Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Doug Rabson wrote: > On Sun, 6 Dec 1998, zhihuizhang wrote: [..] > > Is this in the 2.2 source tree? We used to put the kernel stack of all > processes at the same virtual address (traditionally the struct user for > each process which includes the stack was always mapped in the same place > and could be accessed using the global variable 'u'). I think that with > the definition: > > .set _kstack, USRSTACK > > then from C, you could have: > > extern char kstack[]; > > assert(&kstack[0] == (char*) USRSTACK); > > i.e. to find the top of the kernel stack, take the address of kstack. > > For the 3.0 line, the virtual address of the struct user is different for > each process which makes some things easier (debugging and probably SMP I > guess) at the expense of using two pages of the kernel's virtual address > space per process. For 2.2, we have it mapped twice, once at the fixed virtual address in process space, as well as the two pages in kernel space. The 3.0 change was to remove the stack from the user space in order to allow address space sharing for thread support. However, this probably has to change. What we really need is a fixed kernel address space for the kstack, and an alternate kstack to be mappable (think ptrace etc, registers on another process at the time of a trap may (I think) be on it's kstack. This could be wrong, it's a while since I looked). This way an address space could be shared thousands of times without using '"thousands" times 2' pages of KVM space. This would go part of the way towards solving a few outstanding problems with address space sharing (rfork/ threading) with SMP too. Cheers, -Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message