Merge branch 'master' into isa/arm64
[lunaix-os.git] / lunaix-os / arch / aarch64 / includes / asm / bits.h
1 #ifndef __LUNAIX_ARCH_BITS_H
2 #define __LUNAIX_ARCH_BITS_H
3
4 #include <asm-generic/bits.h>
5
6 #undef _BITS_EXTRACT
7 #undef _BITS_INSERT
8
9 #define _BITS_EXTRACT(from, h, l)       \
10         ({                              \
11             unsigned long _r;           \
12             asm ("ubfm %0, %1, %2, %3"  \
13                  : "=r"(_r)             \
14                  : "r"(from),           \
15                    "i"(l),"i"(h));      \
16             _r;                         \
17         })
18
19 #define _BITS_INSERT(to, from, h, l)    \
20         ({                              \
21             unsigned long _r = to;      \
22             asm ("bfi %0, %1, %2, %3"   \
23                  : "=r"(_r)             \
24                  : "r"(from),           \
25                    "i"(l),              \
26                    "i"(h - l + 1));     \
27             _r;                         \
28         })
29
30
31 #endif /* __LUNAIX_ARCH_BITS_H */