From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Mon, 20 Nov 2006 22:03:08 -0500 From: William Josephson To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] Creating a custom jmp_buf; libthread implementation question Message-ID: <20061121030308.GA40174@mero.morphisms.net> References: <64c8196ab25721b971e64c96b6f8e065@plan9.jp> <7871fcf50611131933h1b7ee706vc56be7b37cd6b58b@mail.gmail.com> <775b8d190611140139i4e28842dndd5bede4255b4b11@mail.gmail.com> <7871fcf50611201903m3a8aaefdk10b544067ef8999c@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7871fcf50611201903m3a8aaefdk10b544067ef8999c@mail.gmail.com> User-Agent: Mutt/1.4.2.1i Topicbox-Message-UUID: e42c30e4-ead1-11e9-9d60-3106f5b1d025 On Mon, Nov 20, 2006 at 10:03:09PM -0500, Joel Salomon wrote: > On 11/14/06, Russ Cox wrote: > >You really care about _threadinitstack (386.c) and setjmp(2). > >"tos" means top of stack. > > What does the line > tos = (ulong*)&t->stk[t->stksize&~7]; > specifically stksize&~7, mean? Um. It means just what it says :-) I.e. round down to the nearest multiple of 8 by clearing the low three bits. Recall which way the stack grows on IA-32...