Skip to content

Instantly share code, notes, and snippets.

@jnthn

jnthn/x.c Secret

Created Nov 1, 2016
Embed
What would you like to do?
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