aa64: finalise context switch, page fault handler and syscall
[lunaix-os.git] / lunaix-os / arch / generic / includes / asm-generic / bits.h
1 #ifndef __LUNAIX_ARCH_GENERIC_BITS_H
2 #define __LUNAIX_ARCH_GENERIC_BITS_H
3
4 #define _BITS_GENMASK(h, l)     \
5         (((1 << ((h) + 1)) - 1) ^ ((1 << (l)) - 1))
6
7 #define _BITS_EXTRACT(from, h, l)     \
8         (((from) & (((1 << (h + 1)) - 1) ^ ((1 << (l)) - 1))) >> (l))
9
10 #define _BITS_INSERT(to, from, h, l)    \
11         (((to) & ~_BITS_GENMASK(h, l)) | (((from) << (l)) & _BITS_GENMASK(h, l)))
12
13 #define _BITS_STATIC(val, h, l)         \
14         (((val) & _BITS_GENMASK(h, l)) << (l))
15
16 #endif /* __LUNAIX_ARCH_BITS_H */