From owner-freebsd-arch Mon Nov 29 9:19:57 1999 Delivered-To: freebsd-arch@freebsd.org Received: from ns1.yes.no (ns1.yes.no [195.204.136.10]) by hub.freebsd.org (Postfix) with ESMTP id 12A5414CB4 for ; Mon, 29 Nov 1999 09:19:52 -0800 (PST) (envelope-from eivind@bitbox.follo.net) Received: from bitbox.follo.net (bitbox.follo.net [195.204.143.218]) by ns1.yes.no (8.9.3/8.9.3) with ESMTP id SAA21540 for ; Mon, 29 Nov 1999 18:19:49 +0100 (CET) Received: (from eivind@localhost) by bitbox.follo.net (8.8.8/8.8.6) id SAA64769 for freebsd-arch@freebsd.org; Mon, 29 Nov 1999 18:19:48 +0100 (MET) Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id 4076514CB4 for ; Mon, 29 Nov 1999 09:19:40 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.3/8.9.1) id JAA06713; Mon, 29 Nov 1999 09:19:39 -0800 (PST) (envelope-from dillon) Date: Mon, 29 Nov 1999 09:19:39 -0800 (PST) From: Matthew Dillon Message-Id: <199911291719.JAA06713@apollo.backplane.com> To: Nate Williams , Julian Elischer , Jason Evans , "Daniel M. Eischen" , freebsd-arch@freebsd.org Subject: Re: Threads References: <19991124220406.X301@sturm.canonware.com> <199911291611.JAA19058@mt.sri.com> <199911291621.IAA06301@apollo.backplane.com> <199911291629.JAA19154@mt.sri.com> <199911291705.JAA06592@apollo.backplane.com> Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG : As you might have gathered, in the case where the thread being : switched in by the kernel has no KSE, the kernel simply resumes : the user thread with an iret. The previous state that was pushed : onto the user thread's stack is restored by a restore vector that : was also pushed onto the user thread's stack. The kernel can use : the per-cpu supervisor stack to temporarily hold the interrupt return : stack to properly restore the user ring. Let me amend this. I got this wrong. The kernel will have a KSE available to it when switching in a thread that has no KSE of its own. This KSE will either be transfered from the previous thread, or allocated. What I was trying to say here was that this KSE is 'idle' in regards to resuming the thread, because all the register state and restore vector is on the user stack and can be restored after we return to user mode. There is no per-cpu supervisor stack per-say, the supervisor stack the kernel uses is the one provided by the KSE. In the case where the kernel is resuming a thread that was in userland, the kernel simply pushes the interrupt restoration vector and ring change as appropriate onto the stack provided by the KSE and issues an IRET, or RETI, or whatever the instruction is. The instruction pops the information (the KSE is thus idle again) and resumes the usermode thread and the restore vector pushed onto the usermode thread. -Matt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message