Date: Wed, 04 Dec 1996 09:33:34 +0100 From: Poul-Henning Kamp <phk@critter.tfs.com> To: Chris Csanady <ccsanady@friley216.res.iastate.edu> Cc: freebsd-smp@freebsd.org Subject: Re: Finished locks.. Message-ID: <1936.849688414@critter.tfs.com> In-Reply-To: Your message of "Tue, 03 Dec 1996 15:08:32 CST." <199612032108.PAA15610@friley216.res.iastate.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <199612032108.PAA15610@friley216.res.iastate.edu>, Chris Csanady wri tes: >For what it's worth, I have completed a simple implementation of spin >locks. (However, I'm sure someone will tell me different.. :) Either >way, it was nice to learn a bit of assembly. > >If these are not sufficient, how can I improve upon them? I'd like to >move some of the locking around, and they would help. In particular, I >am planning to move the global lock out into the syscalls, and perhaps >create a seperate lock for the run queues and such. Then from there, we >can we can reduce the graininess a bit. :) > >Anyway, I'd just like to thank all of you for helping me out. > >Chris > > > > .text > >/*********************************************************************** > * void LOCK() > * ----------------- > * All registers preserved > */ > > .align 2,0x90 > .globl _LOCK >_LOCK: > pushl %eax > pushl %ecx > pushl %edx > movl $_smp_active, %eax > cmpl $0, %eax > je 4f >1: movl 16(%esp), %edx > movl $1, %ecx > movl $0, %eax >2: lock > cmpxchg %ecx, (%edx) -> jne 3f -> jmp 4f + je 4f >3: cmpl %ecx, (%edx) > je 3b I'm sure you don't mean the above jump. > jmp 2b >4: popl %edx > popl %ecx > popl %eax > ret -- Poul-Henning Kamp | phk@FreeBSD.ORG FreeBSD Core-team. http://www.freebsd.org/~phk | phk@login.dknet.dk Private mailbox. whois: [PHK] | phk@tfs.com TRW Financial Systems, Inc. Power and ignorance is a disgusting cocktail.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1936.849688414>