aa64: finalise context switch, page fault handler and syscall
[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 #ifndef __ASM__
7 #undef _BITS_EXTRACT
8 #undef _BITS_INSERT
9
10 #define _BITS_EXTRACT(from, h, l)       \
11         ({                              \
12             unsigned long _r;           \
13             asm ("ubfm %0, %1, %2, %3"  \
14                  : "=r"(_r)             \
15                  : "r"(from),           \
16                    "i"(l),"i"(h));      \
17             _r;                         \
18         })
19
20 #define _BITS_INSERT(to, from, h, l)    \
21         ({                              \
22             unsigned long _r = to;      \
23             asm ("bfi %0, %1, %2, %3"   \
24                  : "=r"(_r)             \
25                  : "r"(from),           \
26                    "i"(l),              \
27                    "i"(h - l + 1));     \
28             _r;                         \
29         })
30
31 #endif
32 #endif /* __LUNAIX_ARCH_BITS_H */