X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=arch%2Fx86_64%2Fatomic.h;h=0d3da6f8780c43562a84b88f0d3fa65322c36325;hp=04f6c28d0bb840d2799c1c3deaac585058b39ebc;hb=075fdb909b7692df7f3c440331114a754267a167;hpb=e914f8b7ec79f622fa3b017af434642f61d45ce8 diff --git a/arch/x86_64/atomic.h b/arch/x86_64/atomic.h index 04f6c28d..0d3da6f8 100644 --- a/arch/x86_64/atomic.h +++ b/arch/x86_64/atomic.h @@ -1,5 +1,5 @@ -#ifndef _INTERNAA_ATOMIC_H -#define _INTERNAA_ATOMIC_H +#ifndef _INTERNAL_ATOMIC_H +#define _INTERNAL_ATOMIC_H #include @@ -10,6 +10,12 @@ static inline int a_ctz_64(uint64_t x) return r; } +static inline int a_ctz_l(unsigned long x) +{ + long r; + __asm__( "bsf %1,%0" : "=r"(r) : "r"(x) ); + return r; +} static inline void a_and_64(volatile uint64_t *p, uint64_t v) { @@ -112,5 +118,10 @@ static inline void a_spin() __asm__ __volatile__( "pause" : : : "memory" ); } +static inline void a_crash() +{ + __asm__ __volatile__( "hlt" : : : "memory" ); +} + #endif