From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lucio De Re To: 9fans@cse.psu.edu Subject: Re: [9fans] Re: Threads: Sewing badges of honor onto a Kernel Message-ID: <20040227120737.G22848@cackle.proxima.alt.za> References: <20040227115257.F22848@cackle.proxima.alt.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: ; from Charles Forsyth on Fri, Feb 27, 2004 at 10:00:32AM +0000 Date: Fri, 27 Feb 2004 12:07:38 +0200 Topicbox-Message-UUID: ff286d18-eacc-11e9-9e20-41e7f4b1d025 On Fri, Feb 27, 2004 at 10:00:32AM +0000, Charles Forsyth wrote: > > >>Just out of curiosity, how do I get to the private space without > >>a lock? It's been a long time since I studied these things and lots > >>of water has flown under bridges, so I could be missing something. > > static __inline Proc *getup(void) { > Proc *p; > __asm__( "movl %%esp, %%eax\n\t" > : "=a" (p) > ); > return *(Proc **)((unsigned long)p & ~(KSTACK - 1)); > }; > > where the process that makes the new process's stack puts a pointer to > the private space (a Proc* in this case) at the base of that stack, and where KSTACK is > a power-of-2. i don't think it can be accessed portably in Linux, > but you don't need a lock. Yeow! And where do I put the returned address, so that no other thread can stomp on it? While I attempt to use it? ++L