On Mon, 18 Dec 2017 22:45:01 GMT "[email protected]" <[email protected]> wrote:

:>I don't remember where I found this snipet of code.
:>
:>         LHI  R1,-1        create lock (0xFFFFFFFF)
:>         LHI  R0,0         create expected lock (0)
:>LOOP     CS   R0,R1,LOCK   If Lock = 0
:>*                          Store R1 into LOCK
:>         BRZ  DONE         We Got The Lock  
:>*                          Else, load LOCK into R0   
:>TEST     LT   R0,LOCK      Try Again (Simple fetch)
:>         BRNZ TEST         Still Locked
:>         BRU  LOOP         No Longer Locked,
:>*                          Try CS Again
:>*
:>*
:>DONE     CNOP  2,4         Proceed                    
                       
:>LOCK     DS    A           Full Word     

:>In the code fragment above why is the LT (Load and Test) instruction 
necessary ?

It isn't.

:>What was the author trying to accomplish after Compare and Swap ?

Create a spin loop?

--
Binyamin Dissen <[email protected]>
http://www.dissensoftware.com

Director, Dissen Software, Bar & Grill - Israel


Should you use the mailblocks package and expect a response from me,
you should preauthorize the dissensoftware.com domain.

I very rarely bother responding to challenge/response systems,
especially those from irresponsible companies.

Reply via email to