Skip to content

Instantly share code, notes, and snippets.

@jnthn

jnthn/x.c Secret

Created November 1, 2016 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnthn/9cc24984158fb26eb8c8ffa7d89bd3ed to your computer and use it in GitHub Desktop.
Save jnthn/9cc24984158fb26eb8c8ffa7d89bd3ed to your computer and use it in GitHub Desktop.
AO_INLINE AO_t AO_fetch_compare_and_swap_full(volatile AO_t *addr,
AO_t old, AO_t new_val)
{
AO_t retval;
__asm__ __volatile__ (
# ifndef __s390x__
" cs %1,%2,0(%3)\n"
# else
" csg %1,%2,0(%3)\n"
# endif
: "2" (retval), "+d" (old)
: "d" (new_val), "a" (addr)
: "cc", "memory");
return retval;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment