Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Properly implement lwarx and stwcx. #11

Closed
benvanik opened this issue Feb 4, 2013 · 1 comment
Closed

Properly implement lwarx and stwcx. #11

benvanik opened this issue Feb 4, 2013 · 1 comment
Labels

Comments

@benvanik
Copy link
Collaborator

benvanik commented Feb 4, 2013

They currently don't do the right thing w.r.t. memory. I'm not sure what I'm doing (acquire/release) does what I think it does, and it's slightly different than the PPC.

@chaoscode
Copy link

http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.aixassem/doc/alangref/lwarx.htm

Per the examples lwarx is a load and reverse on the registry and stwcx copies it if it stays reversed.

  • Assume that GPR 4 contains the new value to be stored.

  • Assume that GPR 3 contains the address of the word

  • to be loaded and replaced.
    loop:

     lwarx   r5,0,r3          # Load and reserve
    
    stwcx.  r4,0,r3          # Store new value if still
    
                             # reserved
    
    bne-    loop             # Loop if lost reservation
    
  • The new value is now in storage.

  • The old value is returned to GPR 4.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants