Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Nov 1999 09:19:39 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Nate Williams <nate@mt.sri.com>, Julian Elischer <julian@whistle.com>, Jason Evans <jasone@canonware.com>, "Daniel M. Eischen" <eischen@vigrid.com>, freebsd-arch@freebsd.org
Subject:   Re: Threads
Message-ID:  <199911291719.JAA06713@apollo.backplane.com>
References:  <19991124220406.X301@sturm.canonware.com> <Pine.BSF.4.10.9911250109290.12692-100000@current1.whistle.com> <199911291611.JAA19058@mt.sri.com> <199911291621.IAA06301@apollo.backplane.com> <199911291629.JAA19154@mt.sri.com> <199911291705.JAA06592@apollo.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help

:	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




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