cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

try_cmpxchg (250B)


      1cat <<EOF
      2static __always_inline bool
      3arch_${atomic}_try_cmpxchg${order}(${atomic}_t *v, ${int} *old, ${int} new)
      4{
      5	${int} r, o = *old;
      6	r = arch_${atomic}_cmpxchg${order}(v, o, new);
      7	if (unlikely(r != o))
      8		*old = r;
      9	return likely(r == o);
     10}
     11EOF